Multiple Binary Boolean Operators in if statement

Multiple Binary Boolean Operators in if statement - Add multiple binary Boolean "or" / "and" operators without force parenthesis - Messages

#1 Posted: 5/6/2022 10:53:10 PM
Larry Burns

Larry Burns

0 likes in 3 posts.

Group: User

When I try to perform this if-or statement:

if a=1 ^ a=2 ^ a=3
x=4
else x =5

I end up with this due to forced parenthesis:

if ((a=1 ^ a=2) ^ a=3)
x=4
else x =5

Could we have capability for multiple binary operators without forced parenthesis enclosure?
#2 Posted: 5/7/2022 12:27:03 AM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 likes in 1674 posts.

Group: User

Hi. The short and honest answer is not. The long and tricky answer is that you can, but you must edit the .sm file and delete the lines with (
However, unless it's for some publishing purpose or something like that, I don't think it's convenient. Also, you can neither copy nor edit it without the parentheses reappearing.

Clipboard01.jpg

and_tryck.sm (2 KiB) downloaded 62 time(s).

Best regards.
Alvaro.
#3 Posted: 5/7/2022 8:59:32 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Think in term of productive Bolean.

Critical.sm (30 KiB) downloaded 71 time(s).
#4 Posted: 5/9/2022 8:01:56 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

Think in term of productive Bolean.


... lot more involved. Adapted from Frank Rioux MCD 11.

Fourier Quantum 2C Mask.sm (22 KiB) downloaded 57 time(s).
#5 Posted: 5/9/2022 8:37:41 AM
Davide Carpi

Davide Carpi

1417 likes in 2873 posts.

Group: Moderator

You can always create some function to make it look like you are working with some set of numbers


2022-05-09 13_37_05-SMath Solver - [some all none.sm_].png
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
3 users liked this post
sergio 5/9/2022 10:55:00 AM, Alvaro Diaz Falconi 5/9/2022 11:19:00 AM, Arie 5/9/2022 4:16:00 PM
#6 Posted: 5/9/2022 10:06:38 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

You can always create some function to make it look like you are working with some set of numbers


Tanks Davide ... coded/saved.
Take care ... Jean.

Maths Conditional Davide.sm (12 KiB) downloaded 70 time(s).

1 users liked this post
sergio 5/9/2022 12:46:00 PM
#7 Posted: 5/9/2022 11:25:27 AM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 likes in 1674 posts.

Group: User

Wrote

You can always create some function to make it look like you are working with some set of numbers



Hi Davide. Great idea. These functions can be very useful for translating matlab programs. They can also be extended to arrays, as the all, any and nnz functions do.

Best regards.
Alvaro.

  • New Posts New Posts
  • No New Posts No New Posts