Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Continued Strings
James Gray
5/12/2005 12:20:00 AM
Here's an interesting code fragment from a Ruby Quiz solution this week:
puts "\nShortest path from #{m.pos2coord(p1).inspect} to " "#{m.pos2coord(p2).inspect}:", m.to_s(path)
Does Ruby concatenate those two String fragments because of the \
line continuation? I didn't know that.
James Edward Gray II
3 Answers
Eric Hodel
5/12/2005 12:30:00 AM
0
On 11 May 2005, at 17:19, James Edward Gray II wrote:
> Here's an interesting code fragment from a Ruby Quiz solution this
> week:
>
> puts "\nShortest path from #{m.pos2coord(p1).inspect} to " > "#{m.pos2coord(p2).inspect}:", m.to_s(path)
>
> Does Ruby concatenate those two String fragments because of the \
> line continuation? I didn't know that.
puts "Yes..." " " "it does"
--
Eric Hodel - drbrain@segment7.net -
http://se...
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04
vikkous
5/12/2005 12:38:00 AM
0
> Does Ruby concatenate those two String fragments because of the > line continuation?
Nope, try it in irb. No backslash necessary:
"foo" "bar" # => "foobar"
(I didn't know that worked either, or i had forgotten. Cute.)
Jim Freeze
5/12/2005 1:38:00 AM
0
* vikkous <google@inforadical.net> [2005-05-12 09:40:27 +0900]:
> > Does Ruby concatenate those two String fragments because of the > > line continuation?
>
> "foo" "bar" # => "foobar"
>
> (I didn't know that worked either, or i had forgotten. Cute.)
This is (last I heard) going away with rite. You may want
to avoid this feature.
--
Jim Freeze
Ruby: I can explain it to ya but I can't understand it fer ya.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Continued Strings
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password