Percent_expression.rb
This content was produced by an LLM and could include errors.
This script demonstrates various Ruby methods (%w, %i, etc.) for generating arrays and symbols. It illustrates how string interpolation affects the resulting data types and values when mixing literal and dynamic arguments.
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\""]
Ruby 4.0.3