A forum for Spin users
You are not logged in.
Pages: 1
In [url]http://spinroot.com/spin/Man/for.html[/url] the second grammar line states that one should use the colon in the for statement for arrays:
for '(' varref ':' array ')' '{' sequence '}' .
However, the example given a little later shows that one should use the 'in' keyword.
int a[10];
for (i in a) {
printf("i = %d\n", i)
}
This problem is also in the grammar in [url]http://spinroot.com/spin/Man/grammar.html[/url] .
As an aside, the examples would be slightly more self-explanatory if they would show that one needs to declare the loop control variable.
Kees.
Offline
As far as i understand things:
The second line in the grammar
range : varref ':' expr '..' expr
| varref ':' varref // this line may be deleted now
| varref IN varref
may now be deleted.
Offline
Pages: 1