Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False boolean not working #82

Open
jasontcs opened this issue Mar 21, 2019 · 1 comment
Open

False boolean not working #82

jasontcs opened this issue Mar 21, 2019 · 1 comment

Comments

@jasontcs
Copy link

jasontcs commented Mar 21, 2019

The following error occurred

boolean trueVar=true
$var:trueVar toString #true

boolean falseVar=false
$var:falseVar toString #UNCAUGHT EXCEPTION: toString

Is it a bug? Or is my implementation incorrect?

@niieani
Copy link
Owner

niieani commented Mar 23, 2019

Actually toString of false boolean is implemented so that it behaves like false:

The return code of false is 1, which means it's treated like an exception.

Probably might sense to change how boolean toString works cause it's unintuitive right now. I don't remember what was the reason I did it like this. I think it's so that invoking that variable would behave similarly to invoking true or false and so that one could use this in comparisons or logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants