Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It 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


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: