Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Oracle
Apprentice


Joined: 29 May 2002
Posts: 121

PostPosted: Sat Oct 09, 2004 7:50 pm   

#if Statement
 
I was looking at the #if statement syntax and realized the false condition is considered optional. Does optional mean if there is no false condition in the #if statement, then #if won't default to the next statement for the false condition?

I've noticed in the past, if I didn't always put a false condition, Zmud would assume there would be a false condition by using the next line or something like that.

Syntax: #IF expression true-command [false-command]
Reply with quote
Rorso
Wizard


Joined: 14 Oct 2000
Posts: 1368

PostPosted: Sat Oct 09, 2004 8:22 pm   
 
If there is no false-branch then that branch wont be run :-). When zero or one branch of the if-statement has been run the next statement in the script is run.

Example:

#if true {#echo true} {#echo false} // Run true-branch. Then continue to next statement.
#echo After if-statement
> true
> After if-statement

#if false {#echo true} // No false-branch. Continue to next statement.
#echo After if-statement
> After if-statement

#if true {#echo true} // Run true-branch. Then continue to next statement.
#echo After if-statement
> true
> After if-statement
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net