About 'nil'
Posted: Thu Mar 13, 2008 9:42 am
Hi!
In Python:
In Ruby:
In Cobra:
Is 'nil' working like it should be?
Thanks.
-necromanco
In Python:
- Code: Select all
>>> type(None)
<type 'NoneType'>
In Ruby:
- Code: Select all
>> nil.type
=> NilClass
In Cobra:
- Code: Select all
print nil.getType # error: DOT operator applied to operand of type "<nil>".
- Code: Select all
x = not nil
print x # output: true
print x.getType # output: System.Boolean
y = nil
print y # output: nil
print y.getType # error: An unhandled exception has occurred.
z as int?
print z.getType # error: System.NullReferenceException
Is 'nil' working like it should be?
Thanks.
-necromanco