-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Logical operator support #2266
Comments
Well, Less development is sort of use-case driven, so even a useful feature thrown in w/o any real-world examples ("just because it can be added or just because Fortran has it") will barely go too far. |
Closing as duplicate of #1894. |
Sorry for mentioning the rival brand :p It's just a logical operation, you can think of handful of real-world use cases for this: @denominator: 0.5;
selector {
height: 1/2 == @denominator ? 3 : 2;
} When implementing it, it would probably make sense to print true / false in case the usual ternary operation is missing: @denominator: 0.5;
some-other-selector-with-dummy-property {
dummy: 1/2 == @denominator;
}
// =>
// some-other-selector-with-dummy-property {
// dummy: true;
//} or not.. Peace! ✌️ |
It's absolutely OK to mention Sass here. My Fortran note was just a sarcastic remark hinting to the fact that Less as a language has very few to do with C-like languages (incl. Sass, JS or PHP) as well as with Fortran :) (I.e. when taking into account some C-like syntax or feature to be added one needs at least to consider possible conflicts with CSS syntax/selectors/ops/etc. Though this was mentioned in #1894 already I guess).
Yes, sure we all know what a ternary operator is. A use-example is better to answer "what for?" question (not just "what?" or "how?")... But, well,never mind - yet again see #1894. |
Don't know what spec has to say about it, but logically this code:
Should compile to
(at least this is how SASS do it)
Currently it throws:
The text was updated successfully, but these errors were encountered: