How to ADD inputs in a program
Posted: Sat Feb 07, 2015 9:36 pm
class Add
def main
print 'Enter two numbers:'
x = Console.readLine
y = Console.readLine
print 'sum is', int.parse(x) + int.parse(y)
print 'done.'
that is the code i used when compiling in xamarin studio cobra language'
but i wonder why i get this error when compiling === Error: Argument 1 of method "parse" expects a non-nilable type (String), but the call is supplying a nilable type (String?). The declaration is "parse(s as String)", the call is supplying an arglist of type "(String?)". (printinput)
def main
print 'Enter two numbers:'
x = Console.readLine
y = Console.readLine
print 'sum is', int.parse(x) + int.parse(y)
print 'done.'
that is the code i used when compiling in xamarin studio cobra language'
but i wonder why i get this error when compiling === Error: Argument 1 of method "parse" expects a non-nilable type (String), but the call is supplying a nilable type (String?). The declaration is "parse(s as String)", the call is supplying an arglist of type "(String?)". (printinput)