Tsallaka zuwa abun ciki
Justice Tech School

Strings

Use single or double quotes. Double quotes allow interpolation with #{}. Strings are mutable.

Example
s = "Ruby"
puts "I love #{s}", 'no #{s}'
s << " rocks"
puts s, s.length, s[0], s[-1], s[1..2]

Result

I love Ruby
no #{s}
Ruby rocks
10
R
s
ub

Exercise

Interpolate.

"Hi name}"

Quiz Test

Which quotes interpolate?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.