0

String Concatenation Instead of String Interpolation.

Why do we have to use string concatenation instead of string interpolation? I think in my own honest opinion. String interpolation is one of the magic of ruby on rails while string concatenation is just an ordinary one. kindly please explain why is it use in this chapter and what is the advantage of over the other and vice versa.

Thanks

-Eric John Iglesia

Community
  • 1
  • 1
  • have a look up to this thread - http://stackoverflow.com/questions/10076579/string-concatenation-vs-interpolation-in-ruby – marmeladze Jan 31 '17 at 05:49

1 Answers1

0

String concatenation is faster (needs less processing power) and safer because you will not need to match parameters with format string and so. With interpolation, you may later remove a parameter (variable) without its matching placeholder in the format string. Concatenation accepts null values as well, this is not possible in a format string.