Receiving too many messages while debugging can be confusing, especially when looking for a specific use case. That is where conditional breakpoints come into play - you can use conditions and filter out just the data you need.
Conditional breakpoints allow you to limit the data collected. You will only collect data when the defined expression evaluates as true. This makes it possible to debug specific scenarios and limit the number of messages you receive.
Setting a condition is done by right-clicking on a breakpoint and selecting the 'Edit' option.
You can use local variables from your code in the condition, as well as our built-in variables.
Rookout provides two condition types, simple and advanced. Switching between these modes is done per breakpoint, in the breakpoint setting pane, by clicking the toggle button shown in the following image:
Using a simple condition, we can compare a variable with some value (or another variable).
Using an advanced condition, we can define a more complex condition using logical parameters. Use "&&" for AND statement, "||" for OR statement, "(" and ")" for encapsulation.
Advanced conditions support the following operators and functions:
|If the values of two operands are equal, then the condition becomes true.|
|If values of two operands are not equal, then condition becomes true.|
|If the value of left operand is greater than the value of right operand, then condition becomes true.|
|If the value of left operand is greater than or equal to the value of right operand, then condition becomes true.|
|If the value of left operand is less than the value of right operand, then condition becomes true.|
|If the value of left operand is less than or equal to the value of right operand, then condition becomes true.|
|If the value of the left operand is included in the right operand, then the condition becomes true.|
|If both the operands are true then condition becomes true.|
|If any of the two operands are non-zero then condition becomes true.|
|Parentheses could be used for changing the precedence when evaluating the conditio|
|Set conditions regarding to a specific sequence’s element - list, dict etc.|
|Use size instead of len or length on any platform|
Keep in mind: the supported syntax may differ between languages.