prefix = "!"
commands = [
"command_1",
"command_2"]
commands.each do |command|
command = prefix + command
end
This is pretty straightforward. I want to change the strings "command_1" & "command_2" to "!command_1" & "!command_2". How would I do that?
mapto store the new strings in a new array, or choose a method which mutates the strings, as the answers and comments indicate.