Closed LuigiPulcini closed 1 month ago
This is a useful addition, as it opens the possibility to implement conditional logic, thanks.
Would you mind:
spec/specs/
for examples)Then I will consider your addition to be merged.
Many thanks for your contribution.
Hi, @bylexus,
Thanks for reviewing my PR so swiftly. I followed both of your recommendations. While adding Unit tests, I spotted a few missing declarations for the new Logical Expression, which I added now, and rebuilt all the distribution files.
Let me know if the tests are enough and if there is anything else I can do.
OK, I have decided that your solution and your implementation of the operator precedence is correct. I will merge your contribution into my develop branch, add some documentation and examples, and release a new version.
many thanks for your useful contribution.
Thanks for reviewing the PR so thoroughly. I am glad that, in the end, it worked out as intended!
This PR adds the possibility of having logical operators and expressions in a formula.
Possible operators are
>
,<
,>=
,<=
,=
and!=
, the meaning of which is trivial.Since the final goal is to use those operators in a mathematical formula, the result of a logical expression will always return a number: either
1
(when the expression istrue
) or0
(when it isfalse
), which can easily be used in a formula to achieve conditional calculations.An example of a logical expression used in a formula is:
This would be essential to implement some logical functions – such as
IF()
– in the same form Microsoft Excel or Google Sheets do: