Skip to content

Instantly share code, notes, and snippets.

@mattb20
Created July 17, 2018 16:58
Show Gist options
  • Save mattb20/609ddae45725bcd5a71f40761c125d1f to your computer and use it in GitHub Desktop.
Save mattb20/609ddae45725bcd5a71f40761c125d1f to your computer and use it in GitHub Desktop.
sum = 0
puts "Please enter a number:"
input = gets.chomp
while input != "Stop"
if input.to_i.class ==
Integer
sum += input.to_i
puts "Please enter a number:"
input = gets.chomp
else
puts "Please enter a number:"
input = gets.chomp
end
end
puts sum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment