SRL Archive - OSR Help

GoTo?


Death12652

2010-05-13 01:09:05

Sorry for so many threads but this is helping greatly. When I am done with this script I will start my RS script. Anyway, is there a way to go back to part of a procedure and do it again a certain amount of times?

Bebe

2010-05-13 01:39:44

repeat
…..
….
until

example:
Procedure Example;
var
c:integer;
begin
c:=0;
repeat
writeln('this is an example');
c:=c+1
until(c>5)
end;

Think I forgot an end/begin but you get the point :p

Nava2

2010-05-13 08:30:13

Bebe, you were correct. :)

Sir R. M8gic1an

2010-05-13 08:34:46

I think he meant using labels. But those are generally discouraged and loops should sort you out well enough :)

~RM

Awkwardsaw

2010-05-13 09:44:33

From: Rasta Magician
I think he meant using labels. But those are generally discouraged and loops should sort you out well enough :)

~RM


why are they discouraged? :) if used correctly, they are really good in fail safes ;)

also if you mean label(it would be best to use repeat or while-do in this case),


var
c : integer;
label
here;
begin
here:
writeln('hello');
inc(c);
if c >= 5 then exit;
if not this then goto here;
end.

mastaraymond

2010-05-13 09:45:40

Nah; Use this as fail safe!


program new;
procedure testme(value : boolean);
var
bool : boolean;
begin
try
bool := value;
Writeln('bool = ' + booltostr(bool));
if bool then
begin
Writeln('Bool was true, lets exit!');
exit;
end;
Writeln('Bool was not true..');
finally
Writeln('We catched the exit!');
end;
end;
begin
testme(true);
testme(false);
end.