Hello, World!


To print things to the console, use "puts", like this

puts 'I will be printed to the console!'

or,

puts "I will be printed to the console!"

Everything between the ' and " will be printed to the console. In single quotation can't support 'Hello world #{some code}' or outher procecs, single quotation only use for string Short syntax for puts is p keyword , example: p 'Hello world'

When you use puts keyword ruby add newline(' n ') on end of line

puts 'Hello World !!!'
Hello World !!!
=> nil

 print 'Hello World !!!'
 Hello World !!!=> nil

if you want add single quotation in an string you most use \ for scape single quotation,example:

puts 'Hello i'm rubiest'
#this code return error
puts 'Hello i\'m rubiest'
# return Hello i'm rubiest

Exercise

Print "Hello, World!" to the console using puts.


test