examples/rosettacode: update ab to not crash on tests
[nit.git] / examples / rosettacode / ab.nit
1 #!/usr/bin/env nit
2 #
3 # This file is part of NIT ( http://www.nitlanguage.org ).
4 # This program is public domain
5
6 # Task: A+B
7 # SEE: <http://rosettacode.org/wiki/A%2BB>
8 #
9 # Generic non-robust version.
10 module ab
11
12 var words = gets.split(" ")
13 if words.length != 2 then
14 print "Expected two numbers"
15 return
16 end
17 print words[0].to_i + words[1].to_i