Skip to content

Commit b32e438

Browse files
committed
Don't mutate a string literal in main code sample
I know this is still being debated, but as of the current version of Ruby, the first code sample does emit a deprecation warning (hidden by default but still). I think it's would be better to not mutate a string literal.
1 parent 898c68a commit b32e438

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

bg/examples/i_love_ruby.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ say = "I love Ruby"
88
puts say
99

1010
# Output "I *LOVE* RUBY"
11-
say['love'] = "*love*"
11+
say = say.sub("love", "*love*")
1212
puts say.upcase
1313

1414
# Output "I *love* Ruby"

0 commit comments

Comments
 (0)