Project

General

Profile

WHILE in Scol » History » Version 1

iri, 09/24/2012 11:59 PM

1 1 iri
h1. WHILE in Scol
2
3
*while* <condition> *do* instructions
4
5
<pre>
6
while <condition> do
7
(
8
	instruction_1;
9
	instruction_2;
10
	instruction_3;
11
	
12
	instruction_n;
13
);
14
</pre>
15
16
If the condition is false at the start, the instructions block is never ran.
17
18
Example :
19
<pre>
20
fun main ()=
21
	_showconsole;
22
	
23
	let 10 -> counter in
24
	while (counter >= 0) do
25
	(
26
		_fooId counter;
27
		set counter = counter-1    // do not forget to increase or decrease your counter, otherwise, the loop can become infinite
28
	);
29
	0;;
30
</pre>
31
	
32
33
License : "CC-BY-SA-2.0":https://creativecommons.org/licenses/by-sa/2.0/
34
Tutorial by iri
35
Updated by /