User Tools

Site Tools


bok:sw:cpp:main

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
bok:sw:cpp:main [2021/06/21 12:10]
anwlur [Boolean Operators] added compound operators
bok:sw:cpp:main [2021/08/12 01:27] (current)
anwlur [if ... else]
Line 59: Line 59:
 </​code>​ </​code>​
  
 +A shorthand is available for simple if...else statements
 +<code cpp>
 +variable = (condition) ? trueStatement : falseStatement;​
 +</​code>​
 +
 +E.g.
 +<code cpp>
 +variable = ( today == birthday ) ? "Happy Birthday"​ : "Good day!";
 +</​code>​
 ==== for ==== ==== for ====
 <code cpp> <code cpp>
bok/sw/cpp/main.txt ยท Last modified: 2021/08/12 01:27 by anwlur