Loops/While: Difference between revisions
Content added Content deleted
Line 278: | Line 278: | ||
]</lang> |
]</lang> |
||
=={{header| |
=={{header|MATLAB}}== |
||
In Matlab (like Octave) the math is done floating point, then rounding to integer, so that 1/2 will be always 1 and never 0. A 'floor' is used to round the number. |
In Matlab (like Octave) the math is done floating point, then rounding to integer, so that 1/2 will be always 1 and never 0. A 'floor' is used to round the number. |
||
<lang Matlab> |
<lang Matlab>i = 1024; |
||
i = 1024; |
|||
while (i > 0) |
while (i > 0) |
||
disp(i); |
disp(i); |
||
i = floor(i/2); |
i = floor(i/2); |
||
end |
end</lang> |
||
</lang> |
|||
=={{header|MAXScript}}== |
=={{header|MAXScript}}== |