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

Accept all types as boolean #25

Closed
wants to merge 1 commit into from
Closed

Accept all types as boolean #25

wants to merge 1 commit into from

Conversation

brad
Copy link
Member

@brad brad commented Sep 19, 2011

Based on this discussion on the mailing list:
http://rocklinux.net/pipermail/openscad/2011-September/001535.html

This commit gives a boolean value to other types and allows their use in "if" statuments.
I used the same logic that PHP uses to determine if a type is true or false:

the boolean FALSE itself
the integer 0 (zero)
the float 0.0 (zero)
the empty string, and the string "0"
an array with zero elements

@whoisjake
Copy link

just throwing my own opinion in here... but I like a very simple and explicit definition of boolean values... at the very least, one of the boolean values.

In Ruby... the rules are simple: symbol/keyword false is false, nil is false, and anything else is true.

@brad
Copy link
Member Author

brad commented Sep 27, 2011

whoops! those commits don't belong in this pull request. I'll fix it.

@brad
Copy link
Member Author

brad commented Sep 27, 2011

Fixed, now these last two comments from me will look completely nonsensical.

@kintel
Copy link
Member

kintel commented Sep 27, 2011

This was fixed in 6659ad4

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

Successfully merging this pull request may close these issues.

None yet

3 participants