sk13pa
Last Updated: February 25, 2016
·
866
· jodosha
Avatar white

TIL Ruby variables string interpolation

Aside from the classic variables string interpolation (#{ var }), Ruby offers a slightly different syntax:

@planet = 'World'
puts "Hello, #@planet!" # => "Hello, World!"

It works also with class (@@var) and global ($var) variables.

Say Thanks
Respond

3 Responses
Add your response

10654
Avatar white

It looks like the Ruby syntax here is broken.

over 1 year ago ·
10741
D5794a938ee30f37d54441d9d3e1556f

wat

over 1 year ago ·
10764
Avatar white

Correct syntax highlight for this protip:
https://gist.github.com/jodosha/7410007

over 1 year ago ·