Hello Guest

and many consecutive "and" can I write in a script

  • 1 Replies
  • 548 Views
*

parisd

  • **
  • 20
  • +0/-0
    • View Profile
and many consecutive "and" can I write in a script
« on: November 26, 2020, 01:16:23 pm »
like
if (N>400) and (A<1) and (B<1) and (C<1) and (D<5) then
xxxxx
end

is there a limit to the "and" in the first line ??

Tks

*

Seuntjie

  • *****
  • 593
  • +17/-3
    • View Profile
Re: and many consecutive "and" can I write in a script
« Reply #1 on: November 26, 2020, 01:28:12 pm »
My 2 minute search couldn't produce any documentation about limits, so there probably isn't a limit. If there is a limit, it's far above what is practical and readable for humans.

The more ands/ors you use in a single if, the harder it becomes to read, understand and maintain. You'll stop understanding what your code does and break it before you hit a limit on the number of conditions in an if.
If you're using 10 and/or in a single if, there's probably a better way to do it (for maintainability and performance).