Skip to content

Instantly share code, notes, and snippets.

@chuck0523
Created August 23, 2015 03:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chuck0523/80786e913ea20e9ee9ff to your computer and use it in GitHub Desktop.
Save chuck0523/80786e913ea20e9ee9ff to your computer and use it in GitHub Desktop.
# 比較演算子
# 等値演算子は同値演算子に変換される
# is isnt なんて書き方もできる
# 連結も可能
x = 13
console.log 'ok' if 10 < x < 20
# true -> yes, on
# false -> no, off
b = true
if b == yes then console.log 'yes!'
# && -> and
# || -> or
# ! -> not
c = no
if b and !c then console.log 'perfect!'
# in 要素があるかどうか
console.log 'exists' if 5 in [1, 3, 5]
# ただし、オブジェクトのプロパティについてはofを使う。
obj =
score : 52
console.log 'has point' if 'score' of obj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment