From 350dd22db20e29409e0b42dba66867431e51480c Mon Sep 17 00:00:00 2001 From: FireIsGood Date: Tue, 12 Nov 2024 20:26:27 -0800 Subject: [PATCH] [ruby/en] clarify alternate hash syntax --- ruby.html.markdown | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ruby.html.markdown b/ruby.html.markdown index 578e8ef3..79e9e8e3 100644 --- a/ruby.html.markdown +++ b/ruby.html.markdown @@ -233,11 +233,14 @@ hash['number'] #=> 5 # Asking a hash for a key that doesn't exist returns nil. hash['nothing here'] #=> nil -# When using symbols for keys in a hash, you can use an alternate syntax. +# When using symbols for keys in a hash, you can use an alternate syntax similar +# to JavaScript. +# key => value hash = { :defcon => 3, :action => true } hash.keys #=> [:defcon, :action] +# key: value hash = { defcon: 3, action: true } hash.keys #=> [:defcon, :action]