Sanny Builder
In English
Search
K

# 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
0@ == 1
1@ == 1
2@ == 1
3@ == 1
4@ == 1
5@ == 1
6@ == 1
7@ == 1
8@ == 1
9@ == 1 // error, too many conditions
10@ == 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
0@ == 1
1@ == 1
2@ == 1
3@ == 1
4@ == 1
5@ == 1
6@ == 1
7@ == 1
8@ == 1
then
if and
9@ == 1
10@ == 1
then
return
end
end
return
`OR`:
// before
if or
0@ == 1
0@ == 2
0@ == 3
0@ == 4
0@ == 5
0@ == 6
0@ == 7
0@ == 8
0@ == 9
0@ == 10 // error, too many conditions
0@ == 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
0@ == 1
0@ == 2
0@ == 3
0@ == 4
0@ == 5
0@ == 6
0@ == 7
0@ == 8
0@ == 9
then
return
end
if or
0@ == 10
0@ == 11
then
return
end
return