Automatic Type Conversion
Posted: Sun Jul 19, 2009 9:35 pm
I am new to cobra and trying to learn it by writing some simple programs.
While writing this program I noticed that Cobra does not seem to have automatic type conversion.
It would be nice if I didn't have to do int.parse(age). Are there any plans to add automatic type conversion to Cobra in the future; similar to what Perl and PHP have?
http://www.brainbell.com/tutors/php/php ... rsion.html
Or is something like this not possible for Cobra?
While writing this program I noticed that Cobra does not seem to have automatic type conversion.
- Code: Select all
class MainProg
def main is shared
print 'What is your age?'
age = Console.readLine
yob = 2009 - int.parse(age)
print 'You were born in [yob].'
It would be nice if I didn't have to do int.parse(age). Are there any plans to add automatic type conversion to Cobra in the future; similar to what Perl and PHP have?
http://www.brainbell.com/tutors/php/php ... rsion.html
Or is something like this not possible for Cobra?