search
LoginSignup
0

posted at

Ruby symbol

a = {"a":1,"c":2}
p a

unless a[:a]
  p "unless a"
end

unless a[:cc]
  p "unless cc"
end

if a[:a]
  p "a ok"
end
if a[:cc]
  p "cc ok"
end
{:a=>1, :c=>2}
"unless cc"
"a ok"

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
What you can do with signing up
0