SRL Archive - OSR Help

Lape code not working


riwu

2013-09-08 00:31:18

From http://villavu.com/forum/showthread.php?t=68613&p=854101#post854101

{$X+}

WriteLn('hoi!');

begin
var i = 0;
for var a := 0 to 2 do
i := i + a * 2;
WriteLn(a);
end;
Line 7 is giving an exception: Found unexpected token "Integer".
Any idea what's wrong with the syntax?

bgtemp

2013-09-08 15:21:58

{$X+}
WriteLn('hoi!');

begin
var i = 1;
var a = 0;
for a to 2 do
i := i + a * 2;
WriteLn(i);

var lol = 1 = 2 - 1 ;
writeln(lol);
end;

It's horrible anyway;

riwu

2013-09-08 19:48:46

From: bgtemp
{$X+}
WriteLn('hoi!');

begin
var i = 1;
var a = 0;
for a to 2 do
i := i + a * 2;
WriteLn(i);

var lol = 1 = 2 - 1 ;
writeln(lol);
end;

It's horrible anyway;

Thanks but that's not what i'm looking for.
I'm trying to figure out why variable declaration and initialization in the for loop statement (which is extremely convenient and imo more readable) is not valid. (nielsie gave it as an example but it don't compile)

stata

2013-09-09 11:20:19

From: riwu
Thanks but that's not what i'm looking for.
I'm trying to figure out why variable declaration and initialization in the for loop statement (which is extremely convenient and imo more readable) is not valid. (nielsie gave it as an example but it don't compile)


I don't see a variable declaration in any of his loop statements (or anyone else's code), but maybe I missed it. I agree though, this is definitely a nice feature.

riwu

2013-09-10 06:19:39

From: stata
I don't see a variable declaration in any of his loop statements (or anyone else's code), but maybe I missed it. I agree though, this is definitely a nice feature.

At http://villavu.com/forum/showthread.php?t=68613&p=854101#post854101
under Loose syntax