Hamed Zahedi
2004-07-03 06:59:11 UTC
I understand that a declaration must preceed any statements inside the body of
an SL program, however, do we also have to ensure that this hold true for
statements written inside if-statements, for-loops and while-loops etc?
i.e. which of the following are valid or are they both valid?
begin
// declaration
//statement
for loop
// statement
//declaration
// satement
endfor;
end;
begin
// declaration
//statement
for loop
//declaration
// satement
endfor;
end;
essentially i'm trying to figure out if we can use the same logic inside a
conditional or looping statement (namely "block") as we use within the body of
our code (namely "body")
thanks in advance
Hamed
----------------------------------------
This mail sent through www.mywaterloo.ca
an SL program, however, do we also have to ensure that this hold true for
statements written inside if-statements, for-loops and while-loops etc?
i.e. which of the following are valid or are they both valid?
begin
// declaration
//statement
for loop
// statement
//declaration
// satement
endfor;
end;
begin
// declaration
//statement
for loop
//declaration
// satement
endfor;
end;
essentially i'm trying to figure out if we can use the same logic inside a
conditional or looping statement (namely "block") as we use within the body of
our code (namely "body")
thanks in advance
Hamed
----------------------------------------
This mail sent through www.mywaterloo.ca