Script Languages Synopsis/if
if/unless control structure
editBash:
if list; then list; [ elif list; then list; ] ... [ else list; ] fi
Perl:
if (expr) {block} [elsif (expr) {block}] [else {block}]
unless (expr) {block} [else {block}]
Ruby:
In Ruby, an if block is an expression, i. e., it returns the last evaluated value. The then keyword can be omitted, if a new line starts at this point.
if expr [then] expr... [elsif expr [then] expr...]... [else expr...] end
Example:
points = if outcome=='gewonnen' then 3 elsif outcome=='unentschieden' then 1 else 0 end
Python:
if expr: block [ elif expr: block ] [ else: block ]
if modifier
editPerl:
statement if expr
statement unless expr
Ruby:
expr if expr