CtrlB
Search
⌃K
🎛

Conditional Expressions

When setting up probes, if it's required to be triggered only under specific circumstances. That's where our conditional logic comes into play. You can use the context of active variables to create these conditions. Dive in to explore how you can utilize the depth of our conditionals:

Supported Data Types

  • Numbers: Integer and decimal values.
  • Strings: Sequence of characters enclosed within quotes.
  • Booleans: True or false values.

Basic Operators

  • ==: Equals
  • !=: Not equals
  • <: Less than (for numbers)
  • <=: Less than or equal to (for numbers)
  • >: Greater than (for numbers)
  • >=: Greater than or equal to (for numbers)

Logical Operators

  • &&: Logical AND
  • ||: Logical OR

Using Brackets for Priority

Brackets ( and ) can be used to group conditions and override the standard priority of operations.

Examples

Given the variables:
number = 5
text = "hello"
flag = True
True Conditions:
  1. 1.
    (number == 5 && text == "hello")
  2. 2.
    (flag || (number == 6 && text != "world"))
  3. 3.
    ((number > 4 || flag) && text != "world")
False Conditions:
  1. 1.
    (number < 5 && text == "hello")
  2. 2.
    (text == "world" || (number != 5 && !flag))
Given the rule (number > 4 && (text == "hello" || (flag && text != "world"))), the system checks if number is greater than 4. If true, it then checks if the text is "hello" or both flag is true and text is not "world".

Future Extensions & Conclusion

We're actively working to support complex data structures like arrays, maps, and objects etc. These will be introduced in the upcoming releases, allowing for even more powerful conditional operations.