`if` function shouldn't evaluate its not returned arg
See original GitHub issueThe sample:
@some: foo;
div {
margin: if((2 > 1), 0, 3px);
color: if((iscolor(@some)), darken(@some, 10%), black);
}
produce with version 3.9.0 the follow error:
RuntimeError: error evaluating function `darken`: color.toHSL is not a function in sample.less on line 5, column 34:
4 margin: if((2 > 1), 0, 3px);
5 color: if((iscolor(@some)), darken(@some, 10%), black);
6 }
it look like that the THEN part is evaluate if the ELSE part should be used.
Issue Analytics
- State:
- Created 5 years ago
- Comments:13 (10 by maintainers)
Top Results From Across the Web
RxJS iif arguments are called when shouldn't - Stack Overflow
The problem is that second argument to iif is called even if test function returns false. This throws an error and app crashes...
Read more >If Statements, Function Returns, Truthy and Falsy - Wes Bos
An if statement will look for the first condition that evaluates to true and then it only runs that block, it will skip...
Read more >Assessment Unit 7 Flashcards | Quizlet
Study with Quizlet and memorize flashcards containing terms like Parameter, Argument, Return and more.
Read more >12.5. Returning a value from a function - Runestone Academy
A return statement, once executed, immediately terminates execution of a function, even if it is not the last statement in the function.
Read more >The Python return Statement: Usage and Best Practices
If you're totally new to Python functions, then you can check out Defining ... The function takes two (non-complex) numbers as arguments and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
No, that’s what I would expect (I was just wondering how/if it also evaluates args before the function itself).
In summary (as far as I understand it) I’m afraid it was just initially not-working example (my bad). Which in turn means the
if
implementation should be improved (the way it is now, thefalse
arg is always evaluated - and this is not what we’d expect (ideally)).FYI - I’ve done some initial work in 4.x to support this feature.