Heads up: This description was created by AI and might not be 100% accurate.

percent_expression.rb

This Ruby code snippet demonstrates string and symbol array creation using different shortcuts.

Ruby code snippet

str='ruby'
#=> "ruby"

%w(a b c "#{str}")
#=> ["a", "b", "c", "\"\#{str}\""]
%W(a b c "#{str}")
#=> ["a", "b", "c", "\"ruby\""]

%i(a b c "#{str}")
#=> [:a, :b, :c, :"\"\#{str}\""]
%I(a b c "#{str}")
#=> [:a, :b, :c, :"\"ruby\""]

Executed with Ruby 3.4.5.