Conditonal/Flow control
Changing the flow of instructions
Cases, A,B,C will all doSomething() then escape (break out of switch statement)
Cases D,E will all doSomethingElse() then break out.
Break
will exit out of the loop/case when hit
if/else
else if
return
Use of block
{}
Dont need them if only one line statement
good to have
Nested if statements
Avoid hard to read
if needing to write a flow chart, needs to be refactored
ternary operator
Only for simple cases, can be hard to read
Links
if
Nested if
Ternary
Case/Switch
Last updated