Skip to content

Instantly share code, notes, and snippets.

@micahlt
Created September 13, 2018 18:55
Show Gist options
  • Select an option

  • Save micahlt/2f1995a5c554fefdf736d05b0d79a514 to your computer and use it in GitHub Desktop.

Select an option

Save micahlt/2f1995a5c554fefdf736d05b0d79a514 to your computer and use it in GitHub Desktop.
0.7.2 Laser created by micahlt - https://repl.it/@micahlt/072-Laser
# Welcome
puts "TextCalC Light 0.71, forked from @micahlt"
def runit
puts "Enter expression"
prob = gets
prob = prob.split
if prob[1] == "*" then
puts prob[0].to_i * prob[2].to_i
if gets.chomp == "again" then
runit
else puts "Done." end
elsif prob[1] == "/" then
puts prob[0].to_i / prob[2].to_i
if gets.chomp == "again" then
runit
else puts "Done." end
elsif prob[1] == "+" then
puts prob[0].to_i + prob[2].to_i
if gets.chomp == "again"
runit
else puts "Done." end
elsif prob[1] == "-" then
puts prob[0].to_i - prob[2].to_i
if gets.chomp == "again"
runit
else puts "Done." end
elsif prob[1] == "ex" then
puts prob[0].to_i ** prob[2].to_i
if gets.chomp == "again" then
runit
else puts "Done." end
end
end
runit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment