Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,22 @@
s = "hello"
puts "#{s} template" #=> "hello template"
# Variable s is intact
puts s #=> "hello"
puts s + " literal" #=> "hello literal"
# Variable s is still the same
puts s #=> "hello"
# Mutating s variable:
s += " literal"
puts s #=> "hello literal"
s << " another" # append to s, use only when string literals are not frozen
puts s #=> "hello literal another"
s = "hello"
puts s.concat(" literal") #=> "hello literal"
puts s #=> "hello literal"
puts s.prepend("Alice said: ") #=> "Alice said: hello literal"
puts s #=> "Alice said: hello literal"