5 ms·
Nice collection. The weird concatenation, I suspect, is a part of the grammar. It's frequently used in C code as well, when the format string is too long to f
by xtacy 15y ago
Nice collection. The weird concatenation, I suspect, is a part of the grammar. It's frequently used in C code as well, when the format string is too long to fit in one line.
printf("%d ... blah blah blah"
"%f ...", 1, 1.2);
- thealistra 15y agoIt actually works for string literals only, so you can't do a real concatenation there, with a variable for example. In C it's done at compile time, so you never actually concat those strings, the literals are merged. From what I see it's the same in ruby: irb(main):001:0> a = "avs" => "avs" irb(main):002:0> "sada" "sadasd" => "sadasadasd" irb(main):003:0> "sada" "sadasd" "sda" => "sadasadasdsda" irb(main):004:0> "sada" "sadasd" a SyntaxError: compile error (irb):4: syntax error, unexpected tIDENTIFIER, expecting $end from (irb):4 from :0