Project

General

Profile

Actions

Backport #6579

closed

Does InteractiveRuBy (IRB) identify newlines embedded in String literals enclosed in double quotes?

Added by RAMUBECSE2003@GMAIL.COM (RAAMU MSRK) almost 12 years ago. Updated almost 12 years ago.


Description

Ruby version:

/usr/local/bin/ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]

Statements/Expressions executed in IRB:

irb(main):011:0> "Yukihiro Matsumoto\nDave Thomas\nAndy Hunt\nChad Fowler"
=> "Yukihiro Matsumoto\nDave Thomas\nAndy Hunt\nChad Fowler"
irb(main):012:0> authors = "Yukihiro Matsumoto\nDave Thomas\nAndy Hunt\nChad Fowler"
=> "Yukihiro Matsumoto\nDave Thomas\nAndy Hunt\nChad Fowler"
irb(main):013:0> authors
=> "Yukihiro Matsumoto\nDave Thomas\nAndy Hunt\nChad Fowler"

However a script file residing in my home directory /home/raamumsrk/Programming Ruby/Practice.rb does output each string terminated by an embedded new-line.

1 #! /usr/local/bin/ruby
2
3 # Author Raamu Mohan Srinivasan Radha Krishnan
4
5 authors = "Yukihiro Matsumoto\nDave Thomas\nAndy Hunt\nChad Fowler"
6
7 puts authors

ruby ./Programming' 'Ruby/Practice.rb
Yukihiro Matsumoto
Dave Thomas
Andy Hunt
Chad Fowler

Actions

Also available in: Atom PDF

Like0
Like0