Created
June 3, 2012 03:31
-
-
Save skusunam/2861719 to your computer and use it in GitHub Desktop.
Flow Controls
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if true == true | |
"we are ok" | |
if true != true then "panic" | |
#There is no ternary in Coffeescript | |
# (i > 0) ? "OK" : "Not OK" | |
if i > 0 then "OK" else "Not OK" | |
(or) | |
if i > 0 then "OK" | |
else "Not OK" | |
# suffixed if statement | |
alert "Hello Reds !!!" if heat < 5 | |
# instead of negation (!) we can use "not" keyword | |
if not true then "panic" | |
# "unless" statement (looks like multi line is mandatory) | |
unless true | |
"panic" | |
# "is" statement which translates to "===" | |
if true is 1 | |
"Type coercion fail!" | |
# "isnt" alternative to "is not" | |
if true isnt true | |
alert "Opposite day!" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (true === true) { | |
"We're ok"; | |
} | |
if (true !== true) { | |
"Panic"; | |
} | |
if (1 > 0) { | |
"Ok"; | |
} else { | |
"Y2K!"; | |
} | |
# suffixed if statement | |
if (heat < 5) { | |
alert ("Hello Reds !!!"); | |
} | |
# instead of negation (!) we can use "not" keyword | |
if (!true) { | |
"panic"; | |
} | |
# "unless" statement (looks like multi line is mandatory) | |
if (!true) { | |
"panic"; | |
} | |
# "is" statement which translates to "===" | |
if (true === 1) { | |
"Type coercion fail!"; | |
} | |
# "isnt" alternative to "is not" | |
if (true !== true) { | |
alert ("Opposite day!"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment