Open shargon opened 6 years ago
if operation:
could be the right python style to do it.
But you can do (and it should work):
>>> def Test(argument):
if argument is not None:
return True
else:
return False
>>> Test(1)
True
>>> Test(None)
False
in this case I think the appropriate would be
def Main(operation=None):
if operation:
return True
else:
return False
avm for this last example is well compiled:
This code originated from the NEX neo-ico-template:
https://github.com/neonexchange/neo-ico-template/blob/master/ico_template.py#L61
I would think these three should be functionally identical:
if operation:
if operation != None:
if operation is not None:
or am I missing something?
Test 1 👍
def Main(operation):
if operation:
return True
else:
return False
Test 2 👍
def Main(operation):
if operation != None:
return True
else:
return False
Test 3 👎
def Main(operation):
if operation is not None:
return True
else:
return False
With new version of compiler I will be interested in this!
I'll have to add a NoneTest
to see and document exactly how it behaves.
This source produce
if (false)
outputAs you can see, is impossible to
return true
in this opCode outputCould you check it @localhuman ?