end语句可以代替Octave中的endfor语句吗? [英] Can end statement replace endfor statement in Octave?
问题描述
此链接说明了我们应该使用 endfor
语句以关闭 for
循环的范围.
但是将其替换为 end
会导致相同的行为.
使用 end
而不是 endfor
有任何意外的副作用吗?
end
在关闭 for
循环时与 endfor
同义./p>
使用 end
的唯一副作用是您的代码也将与MATLAB兼容,因为 endfor
是Octave发明的语言的扩展.我建议您不要使用 endfor
等( endif
, endfunction
, endswitch
, endwhile等)
).
This link illustrates that we should use endfor
statement to close the scope of for
loop.
But replacing it with end
results into the same behavior.
Does using end
rather than endfor
have any unexpected side effects?
end
is synonymous with endfor
when closing a for
loop.
The only side effect of using end
is that your code will also be compatible with MATLAB, as endfor
is an extension of the language invented by Octave. I recommend that you do not use endfor
and the like (endif
, endfunction
, endswitch
, endwhile
).
这篇关于end语句可以代替Octave中的endfor语句吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!