Amazing string concatenation

I am surprised at some string concatenation that I came across on a supported code base. Why, or how is it real, can I combine two lines together?

queue_name = 'gen-request-' "#{ENV['USERNAME'].gsub('.','')}" => "gen-request-robertkuhar" 

I expected to see a β€œ+” between two lines, but it was not there. Is this implied or something like that?

I know this just makes sense with interpolation in the middle. This is not what I ask. I want to know what is the syntax of a language that allows it to work in the first place.

+5
source share
1 answer

This only works for string literals and for partial syntax.

If you have 2 string literals with a space between them, they turn into one line. This is an agreement borrowed from later versions of C.

+2
source

Source: https://habr.com/ru/post/1232663/


All Articles