If statement should allow multiple conditions
See original GitHub issueI often wish I could have an IF command that says if x and y
or if x or y
. I’d want multiple conditions, e.g., the ability to say, if a and b and c and d...
I’d be happy to try to implement this myself, the only problem is I don’t know how to make it backward compatible so the existing if statements still function as they did.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:11 (4 by maintainers)
Top Results From Across the Web
Excel IF function with multiple conditions
If your task requires evaluating several sets of multiple conditions, you will have to utilize both AND & OR functions at a time....
Read more >Multiple IF Conditions in Excel - How to Use? (Easy Steps)
The multiple IF conditions in Excel are IF statements contained within another IF statement. They are used to test multiple conditions simultaneously and ......
Read more >Check multiple conditions in if statement - Python
If -else conditional statement is used in Python when a situation leads to two conditions and one of them should hold true. Syntax:....
Read more >Using IF with AND, OR and NOT functions
The IF function allows you to make a logical comparison between a value and what you expect by testing for a condition and...
Read more >can you have two conditions in an if statement - java
You can have two conditions if you use the double bars( || ). They mean "Or". That means only ONE of your conditions...
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
Two types of ‘If’ feels a bit off to me. Resolving this with a more robust ‘If’ and a second more complex boolean algebra style command like AcademyOfF had originally, is a good solution. So for now, I’d recommend focus on what the minimum of a robust ‘if’ looks like.
We may be covering the majority of frequent cases by simply having a list of the conditions and a tick box for All of these/Any of these. Also a user that wants a very specific and ‘complex’ conditional, may be wanting to use LuaIf anyway.
Note that the improved VariableCondition shouldn’t become any harder to use or require more clicks than it does presently.
I’m excited by the idea of having the user enter pseudo logic and having the command editor check and determine the underlying data it would actually store, but I would keep that as a Phase II of this issue. Goal here should be allowing things like
Thanks for sharing the snippets. They’ll be useful along side the conditions, variables, and looping improvements I was looking into.