Ruby - Programming Language
This course covers the basics of programming in Ruby. Work your way through the videos/articles and I'll teach you everything you need to know to start your programming journey!

Calculator

Lesson 19
Author : GOUP
Last Updated : September, 2020


Code

Copyputs "num1: "
num1 = gets.chomp.to_f

puts "Enter Operator: "
op = gets.chomp

puts "num2: "
num2 = gets.chomp.to_f

if op == "+"
     puts num1 + num2
elsif op == "-"
     puts num1 - num2
elsif op == "/"
     puts num1 / num2
elsif op == "*"
     puts num1 * num2
else
     puts "Invalid Operator"
end