0071: Incorrect number of conditions
A conditional statement exceeds the number of conditions allowed per one statement. The maximum number of conditions combined with the
AND
or OR
operation is 9
.Possible solutions: split the conditional statement so that no statement has more than 9 conditions.
Transforming conditional statements while preserving the logical relation between conditions can be achieved by extracting the conditions into a separate subroutine as demonstrated below.
AND
:// before
if and
[email protected] == 1
[email protected] == 1
[email protected] == 1
[email protected] == 1
[email protected] == 1
[email protected] == 1
[email protected] == 1
[email protected] == 1
[email protected] == 1
[email protected] == 1 // error, too many conditions
[email protected] == 1 // error, too many conditions
then
// then code
else
// else code
end
// after
if
gosub @check
then
// then code
else
// else code
end
:check
if and
[email protected] == 1
[email protected] == 1
[email protected] == 1
[email protected] == 1
[email protected] == 1
[email protected] == 1
[email protected] == 1
[email protected] == 1
[email protected] == 1
then
if and
[email protected] == 1
[email protected] == 1
then
return
end
end
return
OR
:// before
if or
[email protected] == 1
[email protected] == 2
[email protected] == 3
[email protected] == 4
[email protected] == 5
[email protected] == 6
[email protected] == 7
[email protected] == 8
[email protected] == 9
[email protected] == 10 // error, too many conditions
[email protected] == 11 // error, too many conditions
then
// then code
else
// else code
end
// after
if
gosub @check
then
// then code
else
// else code
end
:check
if or
[email protected] == 1
[email protected] == 2
[email protected] == 3
[email protected] == 4
[email protected] == 5
[email protected] == 6
[email protected] == 7
[email protected] == 8
[email protected] == 9
then
return
end
if or
[email protected] == 10
[email protected] == 11
then
return
end
return
Last modified 2yr ago