Created
August 23, 2015 03:05
-
-
Save chuck0523/8bd412fc360d1cdd68e8 to your computer and use it in GitHub Desktop.
This file contains 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 | |
score = 80 | |
# 基本形 | |
if score > 60 | |
console.log score | |
# 1行で書く | |
if score > 60 then console.log score | |
# 条件文の後置 | |
console.log score if score > 60 | |
# JS書いてきた人にはわかりやすい書き方 | |
if score > 60 | |
console.log 'ok' | |
else | |
console.log 'ng' | |
# elseも含めて1行で書いちゃう | |
if score > 60 then console.log 'ok' else 'ng' | |
# coffeeでは三項演算子は使えない | |
# condition ? a : b ; | |
msg = if score > 60 then 'ok' else 'ng' | |
console.log msg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment