Skip to content

Instantly share code, notes, and snippets.

@2get
Created February 5, 2015 06:11
Show Gist options
  • Save 2get/be0910e768bb6abcd6eb to your computer and use it in GitHub Desktop.
Save 2get/be0910e768bb6abcd6eb to your computer and use it in GitHub Desktop.
case 式の返り値に対しての処理
def case1
i = 1
case i
when 1
5
end + 10
end
def case2
i = 1
case i
when 1
'1'
end + "www"
end
puts case1 # => 15
puts case2 # => 1www
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment