# Two Question

**URL:** <https://www.ruby-forum.com/t/two-question/192008>\
**Category:** Ruby\
**Created:** [July 22, 2010, 10:59am UTC](https://www.ruby-forum.com/t/two-question/192008 "2010-07-22T10:59:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![amiref](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/41988e/32.png) [@amiref](https://www.ruby-forum.com/u/amiref)\
**Post date:** [July 22, 2010, 10:59am UTC](https://www.ruby-forum.com/t/two-question/192008/1 "2010-07-22T10:59:43Z")

</div>

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” ?

---

<div class="post-metadata">

**Author:** ![amiref](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/41988e/32.png) [@amiref](https://www.ruby-forum.com/u/amiref)\
**Post date:** [July 22, 2010, 12:05pm UTC](https://www.ruby-forum.com/t/two-question/192008/2 "2010-07-22T12:05:20Z")

</div>

n Thu, Jul 22, 2010 at 10:59 AM, Amir E. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> 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](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](http://ruby-doc.org/core/classes/IO.html#M002252)  
print: [module Kernel - RDoc Documentation](http://ruby-doc.org/core/classes/Kernel.html#M005952)

Jesus.

---

<div class="post-metadata">

**Author:** ![amiref](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/41988e/32.png) [@amiref](https://www.ruby-forum.com/u/amiref)\
**Post date:** [July 22, 2010, 2:07pm UTC](https://www.ruby-forum.com/t/two-question/192008/3 "2010-07-22T14:07:42Z")

</div>

Unsubscribe

Sent from my iPhone

---

<div class="post-metadata">

**Author:** ![amiref](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/41988e/32.png) [@amiref](https://www.ruby-forum.com/u/amiref)\
**Post date:** [July 22, 2010, 11:20am UTC](https://www.ruby-forum.com/t/two-question/192008/4 "2010-07-22T11:20:49Z")

</div>

On Thu, Jul 22, 2010 at 3:59 AM, Amir E. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
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/](http://www.ruby-forum.com/).

regarding 2:

5.times { puts “abc” }  
5.times { print “xyz” }

---

<div class="post-metadata">

**Author:** ![amiref](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/41988e/32.png) [@amiref](https://www.ruby-forum.com/u/amiref)\
**Post date:** [July 22, 2010, 3:58pm UTC](https://www.ruby-forum.com/t/two-question/192008/5 "2010-07-22T15:58:59Z")

</div>

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](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
