Mega Code Archive

 
Categories / Ruby / Language Basics
 

Get acquainted with math operations in Ruby

puts 3 + 4 # add puts 7 - 3 # subtract puts 3 * 4 # multiply puts 12 / 4 # divide puts 12**2 # raise to a power (exponent) puts 12 % 7 # modulo (remainder)