1.for end
for循环,i从1至10,循环
for i=1:10
do something
end通过设置你的 indices (索引) 等于 1一直到10,来做到这一点。这时indices 就是一个从1到10的序列。

2.break continue
break:退出循环
continue:退出此次循环
3.while end
while i<5
do something
end4.if end
while i<5
do something
endif elseif end
if i == 1
do something
elseif i == 2
do something
else
do something
end5.函数function end

Octave允许返回多个值或多个参数

本文介绍了编程中的基本控制结构,包括forendfor循环、break和continue语句、while循环、if条件判断语句以及函数定义等。这些控制结构是编程语言的基础,掌握它们对于编写有效的程序至关重要。
220

被折叠的 条评论
为什么被折叠?



