Sudipta
3rd August 2005, 10:06
Dear all,
in a script i have used nested if condition. But i m getting error message in the last endif that "=" not expected.
inside of an if condition i have used 28 nested if conditon. so when i m using one more if condition then i m getting the error message. Upto this number it is not giving any error.

So is there any restriction of using if conditions inside of an if condition or is there any restriction of using nested if condition.

If anyone have any solution for this then kindly let me know.
if required i can send the script also.


Regards
Sudipta

mr_suleyman
3rd August 2005, 12:54
Hi there ,
your problem is not clear enough , if you sent your script , solution may be found .!

Good luck.

fallguyjg
5th August 2005, 00:55
Sudipta,

I just tried 33 if statements and got a compile error.
Then I backed off to 32 ifs, and it worked.

before.program:
test(0)

function test(long x)
{
if x then
else if x then
else if x then
else if x then
else if x then
else if x then
else if x then
else if x then
else if x then
else if x then
else if x then
else if x then
else if x then
else if x then
else if x then
else if x then
else if x then
else if x then
else if x then
else if x then
else if x then
else if x then
else if x then
else if x then
else if x then
else if x then
else if x then
else if x then
else if x then
else if x then
else if x then
else if not x then |32 ifs compiles OK
| else if not x then |33 ifs compile error
message("Made it")
| endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
}


To expand the if statement usage, I'm thinking that you will have to use groups of nested if statements.

function test(long x)
{
long level.1, level.2

| level 1
if x then
else if x then
else if x then
else if x then |4 ifs
level.1 = true
endif
endif
endif
endif

| level 2
if not level.1 then | test level 2
if x then
else if x then
else if x then
else if x then |4 ifs
level.2 = true
endif
endif
endif
endif
endif

| level 3
if not level.2 then | test level 3
if x then
else if x then
else if x then
else if not x then |4 ifs
message("Made it")
endif
endif
endif
endif
endif
}

Hope this helps,
fallguyjg