Skip to content

Instantly share code, notes, and snippets.

@ro31337
Created September 12, 2020 17:51
Show Gist options
  • Save ro31337/ee9a5aad087f80e215a300eaf4b8a1ec to your computer and use it in GitHub Desktop.
Save ro31337/ee9a5aad087f80e215a300eaf4b8a1ec to your computer and use it in GitHub Desktop.
INFINITY = 1.to_f / 0
def spaced(s)
s.scan(/.{1,5}/).join(' ')
end
10.times do
a = b = INFINITY
loop do
a = rand(0..10)
b = rand(0..10)
break if a + b <= 10
end
puts "#{a} + #{b} = "
puts
puts "#{spaced('.' * a)} + #{spaced('.' * b)} ="
puts
puts
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment