M
Michael Chow
puts "abcdefg".gsub(/abc/) do |x|
x.upcase
end
^This does not work. ArgumentError, it's expecting the second argument
that's required when a block is not provided.
puts "abcdefg".gsub(/abc/) { |x|
x.upcase
}
^This works.
Why??
x.upcase
end
^This does not work. ArgumentError, it's expecting the second argument
that's required when a block is not provided.
puts "abcdefg".gsub(/abc/) { |x|
x.upcase
}
^This works.
Why??