Skip to content

Instantly share code, notes, and snippets.

@taisyo7333
Created February 22, 2016 00:02
Show Gist options
  • Save taisyo7333/d86e57c2adf4ea90b56f to your computer and use it in GitHub Desktop.
Save taisyo7333/d86e57c2adf4ea90b56f to your computer and use it in GitHub Desktop.
Ruby 悩んだこと # 1
true || y = 1
p y # => nil
@taisyo7333
Copy link
Author

以下のように勘違いしていた。
y = 1の部分は評価されないため、
p y
で例外が発生する。
しかし、実際は nil

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment