Check out our blog!
Forumwarz is the first "Massively Single-Player" online RPG completely built around Internet culture.

You are currently looking at Flamebate, our community forums. Players can discuss the game here, strategize, and role play as their characters.

You need to be logged in to post and to see the uncensored versions of these forums.

Log in or Learn about Forumwarz

Role Playing
Switch to Civil Discussion Role-Playing

Viewing a Post

notameme Posted:

Conditional Operator

  You can exchange simple if-else code for a single operator – the conditional operator. 
 The conditional operator is the only C++ ternary operator (working on three values). 
 Other operators you have seen are called binary operators (working on two values).


FORMAT: 

conditional Expression ? expression1 : expression2;

  ** if the conditional Expression is true, expression1 executes, otherwise if the 
conditional Expression is false, expression 2 executes. 

If both the true and false expressions bumign values to the same variable, you can improve 
the efficiency by bumigning the variable one time:

(a>b) ? (c=25) : (c=45); 

can be written as:

c = (a>b) ? 25 : 45;


I'M A SIG-DISABLING COCKMONGLER
Internet Delay Chat
Have fun playing!
To chat with other players, you must Join Forumwarz or Log In now!