LoginSignup
72
73

More than 5 years have passed since last update.

coffee-scriptをよりrubyらしく書く方法

Posted at

こんなコードがあったとします。

onload = ->
  if 1 isnt 2
    setTimeout (-> console.log "hello"), 100
onload()

ナンセンスな無意味なコードです。
Ruby的な考えからするとなにかが足りない。そう、end ですね!

coffeescriptでend を書く方法!

そうだendを定義すればいいんだ!

end = null

onload = ->
  if 1 isnt 2
    setTimeout (-> console.log "hello"), 100; end
  end
end
onload()

うおーカッケー(棒)

72
73
6

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
72
73