Because using double or single quotes in Ruby on Rails changes the result that is printed?

0

Because changing the syntax of the code using double or single quotes changes the result that is printed?

<puts"hola \n nueva "
puts'hola \n nueva '>
    
asked by vifrac 04.01.2019 в 06:06
source

2 answers

1

In ruby there is a distinction between double and single quotes. If you use double quotes, the content is evaluated and the interpolated code is executed between # {}, if any.

Likewise, escape sequences like \ n will not work, for example. That is why you are shown different results.

Greetings

    
answered by 04.01.2019 в 09:25
0

In the programming languages the single quote makes a direct cast to string does not validate special characters or variables. While with the double quotes the content of the string is evaluated in search of varibles or special characters.

    
answered by 04.01.2019 в 21:33