NCDS
2009-08-01 21:27:01
Figured I would clear this up for some of the beginner scripters.
Just think of else like you would in real life. Do something, or else do something else. Well, that's the same way it works in Scar.
Now, Ill show you…
else
Well, this is because if you put a semicolon before an else Scar will return an error.
Seems easy enough right?
end else
end else is just two basic things put together. Obviously, end and else.
Ex:
Thats where end else comes in.
So,
But,
You see? quite simple.
If anyone needs more explanation feel free to ask.
Just think of else like you would in real life. Do something, or else do something else. Well, that's the same way it works in Scar.
Now, Ill show you…
else
procedure TeachEm;
begin
if (ThisReturnsTrue) then
DoThis
else
DoThis;
end;
Notice that there is not a semicolon after the first "DoThis" but there is after the second one.Well, this is because if you put a semicolon before an else Scar will return an error.
Seems easy enough right?
end else
end else is just two basic things put together. Obviously, end and else.
Ex:
procedure TeachEm;
begin
if (ThisReturnsTrue) then
begin
DoThis
andthis
end else
DoThis2;
end;
As you all know (if not then now you do) if..then statements will only execute the line after it unless that line is a "begin". In which case it would execute what is between the begin..end nest. Thats where end else comes in.
So,
if (ThisReturnsTrue) then
Scar will execute:
DoThis
andthis
But,
if (ThisReturnsTrue) then
Doesn't return true, then Scar will execute this:
DoThis2;
You see? quite simple.
If anyone needs more explanation feel free to ask.