[RUBY] About expression expansion.

Expression expansion

** Expression expansion is a feature that allows you to put an expression inside a string. ** **

** To write the expression expansion, just write # {expression} </ font> in the string. ** **

** When expanding expressions, double quotation marks "</ font> when creating a string Must be enclosed in. ** ** ** If you enclose it in single quotation marks' </ font>, the expression will not be expanded. ** **

Let's run the following code in irb

Let's try expression expansion.

irb


#Expression expansion includes an expression in a string
irb(main):001:0> "Today#{20}I'm old"
=> "I'm 20 years old today"

#Expression is not expanded with single quotes
irb(main):002:0> 'Today#{20}I'm old'
=> "Today\#{20}I'm old"

Summary

** Expressions are "character strings", "numbers", "variables", "operator expressions", etc. in Ruby. Expression expansion is a function that allows you to put an expression in a character string. ** **

that's all.