While

From Mesham
Revision as of 16:03, 31 December 2009 by Polas (talk | contribs) (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…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Syntax

while (condition) whilebody;

Semantics

Will loop whilst the condition holds.

Examples

var a:=10;
while (a > 0)
{
   a:=a - 1;
};

Will loop, each time decreasing the value of variable a by 1 until the value is too small (0)