Project

General

Profile

Backport #6579

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

Added by RAMUBECSE2003@GMAIL.COM (RAAMU MSRK) over 7 years ago. Updated over 7 years ago.

Status:
Rejected
Priority:
Normal
[ruby-core:45586]

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

History

Updated by naruse (Yui NARUSE) over 7 years ago

  • Status changed from Open to Rejected

irb uses p method instead puts.

Also available in: Atom PDF