Skip to content

Instantly share code, notes, and snippets.

@boddhisattva
Last active August 29, 2015 13:56
Show Gist options
  • Save boddhisattva/9081801 to your computer and use it in GitHub Desktop.
Save boddhisattva/9081801 to your computer and use it in GitHub Desktop.
Playing with numbers in Ruby
20
6
50
Subtraction of 50 - 30 is: 20
Exponentiation of 3^3 is: 27
Value of 5 modulo 3 is: 2
# playing with numbers.. Checking the general backslashes to be run..
puts( 4 * 5)
puts("\n")
# This is not allowed..I guess.. puts (100/20) puts("\t") puts(20 + 30)
puts (100/20 + 90/54)
puts("\t")
puts(20 + 30)
# Escape sequences and all need to be given with double quotes not single quotes.. puts("\n")
puts("\n")
num = 50 - 30
puts("Subtraction of 50 - 30 is: \t #{num}")
num1 = 3**3
puts("Exponentiation of 3^3 is: \t #{num1}")
num2 = 5%3 # Modulo in operation.. do note..
puts("Value of 5 modulo 3 is: \t #{num2}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment