Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Learning_ruby

# Numbers and Maths
puts "I will now count my chickens."       # prints the statement mentioned
puts "Hens #{25 + 30 / 6}"                 # prints the calculation done inside #{}
puts "Rooster #{100 - 25 * 3 % 4}"         # Same as above line
puts "Now I will count eggs"               # prints the statement mentioned
puts 3 + 2 + 1 - 5 + 4 % 2 -1 / 4 + 6      # prints the result of calculation
puts "Is it true that 3 + 2 < 5 - 7?"      # prints the statement mentioned
puts 3 + 2 < 5 - 7                         # prints true or false 
puts "what is 3 + 2? #{3 + 2}"             # prints the result of #{3 + 2}
puts "what is 5 - 7? #{5 - 7}"             # prints the result of #{3 + 2}
puts "Oh, thats why its false."            # prints the statement mentioned 
puts "How about some more"                 # prints the statement mentioned 
puts "Is it greater? #{5 > -2}"            # prints the result as true or false
puts "Is it greater or equal? #{5 >= -2}"  # prints the result as true or false
puts "Is it less or equal? #{5 <= -2}"     # prints the result as true or false

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.