Jump to content
CESCH

cases

Recommended Posts

[sCAR]

case random(2) of

0: writeln('0');

1: writeln('1');

end;[/sCAR]

 

And if you would like some more code in the cases then just 1 line then do it like this:

 

[sCAR]case random(2) of

0:

begin

writeln('0');

writeln('Hi');

end;

1:

begin

writeln('1');

writeln('lala');

end;

end;[/sCAR]

Link to comment
Share on other sites

Note that unlike Java, break statements aren't used in Pascal case statements, a Java switch can remove the breaks to jump into a next case, this isn't possible with Pascal case statements. You can however evaluate multiple values with the same case.

 

[scar]case X of

1..8: begin end; // This is a value range

10, 11: begin end; // This are 2 separate values

9, 12..15: begin end; // They can also be combined

else begin end; // Default

end;[/scar]

 

http://wiki.scar-divi.com/index.php?title=The_Official_SCAR_Scripting_Guide#Case_Statements

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...