Comparison
Nada supports standard comparison operations for comparing numerical values. These operators return boolean values (true/false) and can be used in conditional statements or calculations. Each comparison is performed securely, maintaining the privacy of the operands.
The following comparison operators are available:
Less than <
Returns true
if the first value is less than the second value.
- Nada program
- Test file
src/comparison_lt.py
loading...
tests/comparison_lt_test.yaml
loading...
Run and test the comparison_lt program
1. Open "Nada by Example"
2. Run the program with inputs
from the test file
nada run comparison_lt_test
3. Test the program with inputs
from the test file against the expected_outputs
from the test file
nada test comparison_lt_test
Less than or equal to <=
Returns true
if the first value is less than or equal to the second value.
- Nada program
- Test file
src/comparison_lte.py
loading...
tests/comparison_lte_test.yaml
loading...
Run and test the comparison_lte program
1. Open "Nada by Example"
2. Run the program with inputs
from the test file
nada run comparison_lte_test
3. Test the program with inputs
from the test file against the expected_outputs
from the test file
nada test comparison_lte_test
Greater than >
Returns true
if the first value is greater than the second value.
- Nada program
- Test file
src/comparison_gt.py
loading...
tests/comparison_gt_test.yaml
loading...
Run and test the comparison_gt program
1. Open "Nada by Example"
2. Run the program with inputs
from the test file
nada run comparison_gt_test
3. Test the program with inputs
from the test file against the expected_outputs
from the test file
nada test comparison_gt_test
Greater than or equal to >=
Returns true
if the first value is greater than or equal to the second value.
- Nada program
- Test file
src/comparison_gte.py
loading...
tests/comparison_gte_test.yaml
loading...
Run and test the comparison_gte program
1. Open "Nada by Example"
2. Run the program with inputs
from the test file
nada run comparison_gte_test
3. Test the program with inputs
from the test file against the expected_outputs
from the test file
nada test comparison_gte_test