I have a procedure that has a If, Then, end else statement. Is it possible to do another end else. Like this...
Or is there something like that?Code:If Then begin end else end else
I have a procedure that has a If, Then, end else statement. Is it possible to do another end else. Like this...
Or is there something like that?Code:If Then begin end else end else
Sort of. You'd have to do this:
SCAR Code:if .. then
begin
...
end else if ..
begin
...
end else
begin
...
end;
You'd use else if (something) for each one save the last.
oh thanks
No, you don't.
SCAR Code:program New;
var
wat : integer;
begin
wat := 2;
if wat = 0 then
writeln('Wat is zero.')
else if wat = 1 then
writeln('Wat is one')
else if wat = 2 then
writeln('Wat is two.');
end.
Join the IRC! irc.rizon.net:6667/srl | SQLite (0.99rc3+) | SRL Doc | Simba Doc | Extra Simba Libraries (openSSL & sqlite3)
Originally Posted by #srl
"A programmer is just a tool which converts caffeine into code"
^ I think he was only saying that because death might not understand that single line if..then/others (lazy) don't need a begin end. :3
If you are going to nest a begin and end block, just add a begin and end under the else if; otherwise, leave out the semicolon after the line.
Join the IRC! irc.rizon.net:6667/srl | SQLite (0.99rc3+) | SRL Doc | Simba Doc | Extra Simba Libraries (openSSL & sqlite3)
Originally Posted by #srl
"A programmer is just a tool which converts caffeine into code"
There are currently 1 users browsing this thread. (0 members and 1 guests)