ruby on rails - Use \ instead of + or << to concatenate those strings -
I'm using RookOp to clean my dirty code ...
A There were errors:
useinstead of + or
Why is that so?
I can not find it. + or & lt; Why would I use the \ instead of
ruby In, virtual wires are allocated as objects in memory, when they come in front. If you add two string literals, like
str = "foo" + "bar" you will actually assign three strings Objects: "foo" , "bar" and combination result (which is then referred to by str )
It is as if you do:
"foo" & lt; & Lt; "Bar" In many cases, this is only a light inability that you should not worry too much.
However, keep in mind that if you do this, a loop, and if the total string gets bigger, then you should use an ever greater string < / Code> will assign objects (even if you call it string parts as aaa , and then call ; foo
\ in' you can not add intermediate objects, but instead the parser has a string > literal (because \ is just continuing the string on the next line).
"foo" + "bar" + "baz"
Comments
Post a Comment