Hi everybody
I have two question :
1 - What is the exact meaning of Literals in Ruby ?
2 - What is the use of "puts" in Ruby and what is diffrence between
"puts" and "print" ?
···
--
Posted via http://www.ruby-forum.com/.
Hi everybody
I have two question :
1 - What is the exact meaning of Literals in Ruby ?
2 - What is the use of "puts" in Ruby and what is diffrence between
"puts" and "print" ?
--
Posted via http://www.ruby-forum.com/.
regarding 2:
5.times { puts "abc" }
5.times { print "xyz" }
On Thu, Jul 22, 2010 at 3:59 AM, Amir Ebrahimifard <amiref@ymail.com> wrote:
Hi everybody
I have two question :
1 - What is the exact meaning of Literals in Ruby ?
2 - What is the use of "puts" in Ruby and what is diffrence between
"puts" and "print" ?
--
Posted via http://www.ruby-forum.com/\.
Hi everybody
I have two question :
1 - What is the exact meaning of Literals in Ruby ?
http://ruby-doc.org/docs/ProgrammingRuby/html/language.html
Take a look at the section: The Basic Types.
2 - What is the use of "puts" in Ruby and what is diffrence between
"puts" and "print" ?
As Josh says it's easy to try and see:
puts "a"
puts "b"
print "a"
print "b"
Or also, you can read the explanation here:
puts: class IO - RDoc Documentation
print: module Kernel - RDoc Documentation
Jesus.
n Thu, Jul 22, 2010 at 10:59 AM, Amir Ebrahimifard <amiref@ymail.com> wrote:
1-
lit·er·al
n accordance with, involving, or being the primary or strictmeaning of the w
ord or words; not figurative ormetaphorical: the literal meaning of a word.
There for a RUBY literal String is as follows:
"this is a string, literally"
http://ruby-doc.org/docs/ProgrammingRuby/html/language.html
2 -
irb(main):005:0> 5.times { print " print output no newline " }
print output no newline print output no newline print output no newline
print output no newline print output no newline => 5
irb(main):006:0> 5.times { puts " puts output has a newline " }
puts output has a newline
puts output has a newline
puts output has a newline
puts output has a newline
puts output has a newline
=> 5
From: Amir Ebrahimifard <amiref@ymail.com>
Reply-To: <ruby-talk@ruby-lang.org>
Newsgroups: comp.lang.ruby
Date: Thu, 22 Jul 2010 17:59:45 +0900
To: ruby-talk ML <ruby-talk@ruby-lang.org>
Subject: Two QuestionHi everybody
I have two question :
1 - What is the exact meaning of Literals in Ruby ?
2 - What is the use of "puts" in Ruby and what is diffrence between
"puts" and "print" ?
--
Posted via http://www.ruby-forum.com/\.