Difference between revisions of "While"
From Mesham
Jump to navigationJump to search (Created page with '==Syntax== while (condition) whilebody; ==Semantics== Will loop whilst the condition holds. == Examples == var a:=10; while (a > 0) { a:=a - 1; }; Will loop, each t…') |
m (4 revisions imported) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 9: | Line 9: | ||
== Examples == | == Examples == | ||
− | var a:=10; | + | function void main() { |
− | + | var a:=10; | |
− | + | while (a > 0) { | |
− | + | a--; | |
+ | }; | ||
}; | }; | ||
− | Will loop, each time decreasing the value of variable ''a'' by 1 until the value is too small (0) | + | Will loop, each time decreasing the value of variable ''a'' by 1 until the value is too small (0). |
+ | |||
+ | ''Since: Version 0.41b'' | ||
[[Category:Sequential]] | [[Category:Sequential]] |
Latest revision as of 15:44, 15 April 2019
Syntax
while (condition) whilebody;
Semantics
Will loop whilst the condition holds.
Examples
function void main() { var a:=10; while (a > 0) { a--; }; };
Will loop, each time decreasing the value of variable a by 1 until the value is too small (0).
Since: Version 0.41b