Originally Posted by Flight
Quote:
Originally Posted by riwu
Hey flight i have a simple qns about a script logic:
Simba Code:
procedure WalkLadder;
begin
Action 1;
if (Condition1) then WalkLadder;
Action 2;
end;
In the above example, if condition1 is fulfilled, what is going to happen? it will perform Action 1 again, then checks condition again, and if false it will perform Action 2, then continue with the first loop and perform Action 2 again?
So basically the correct way to do it (w/o it repeating Action 2 twice) is to put:
Simba Code:
if (Condition1) then
begin
WalkLadder;
Exit;
end;
Am i right?
Tell me if this makes sense:
Simba Code:
procedure WalkLadder;
begin
Action 1; //Action 1 always used
if (Condition1) then //Only if this condition results "True"
WalkLadder
else //If not then do Action 2
Action 2;
end;