Content deleted Content added
No edit summary |
→Ruby version: New implementation in same spirit but with more idiomatic Ruby, removed sentence about not repeating overflow values, since it is not discussed elsewhere in the article. |
||
Line 62:
The [[Ruby (programming language)|Ruby]] version takes advantage of some of its features:
<source lang="ruby">
Array.new(11) { gets.to_i }.reverse.each do |x|
raise if y > 400
puts "#{x} #{y}"
puts "#{x} TOO LARGE"
end
▲ begin
▲ end
▲ rescue
▲end</source>
Ruby handles extremely large values very easily, even on 64-bit systems, so the possibility of an overflow in the above program would be slim
==References==
|