the difference between 'null' and 'false' ?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

the difference between 'null' and 'false' ?

nozer0
If I convert these terms from 'jack' to 'vm', do they get the same result?

'let a = null'
-> 'push constant 0' 'pop local 0'

'let a = false'
-> 'push constant 0' 'pop local 0'

'let a = 0'
-> 'push constant 0' 'pop local 0'
Reply | Threaded
Open this post in threaded view
|

Re: the difference between 'null' and 'false' ?

cadet1620
Administrator
The Jack specification says that "null and false are mapped to the constant 0."

There should be no difference in the generated VM code whether you use null, false or 0.

--Mark

Reply | Threaded
Open this post in threaded view
|

Re: the difference between 'null' and 'false' ?

nozer0
Thank you so much