question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

If statement should allow multiple conditions

See original GitHub issue

I 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:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
stevehalliwellcommented, Feb 17, 2020

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

  • If hasRedKey == true AND wasRudeToMargret == false
  • if passwordCorrect == true OR charisma >= 80
1reaction
stevehalliwellcommented, Nov 24, 2019

Thanks for sharing the snippets. They’ll be useful along side the conditions, variables, and looping improvements I was looking into.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found