RosettaCodeData/Task/Loops-Foreach/Octave/loops-foreach-1.octave

9 lines
178 B
Plaintext

a = [ 1,4,3,2 ];
b = [ 1,2,3,4; 5,6,7,8 ];
for v = a
disp(v); % output single values: 1,4,3,2
endfor
for v = b
disp(v); % v is the column vector [1;5], then [2;6] ...
endfor