### Author Topic: Expression Nesting...  (Read 828 times)

0 Members and 1 Guest are viewing this topic.

#### Brian Alvarez

• Hero Member
• Posts: 699
##### Expression Nesting...
« on: February 20, 2020, 02:42:57 am »
Im having trouble with this:

Code: [Select]
`Result = (IIF(Eval(RIGHT(Conc, 1)="S"), 10, 20))`
Code: [Select]
`ERROR: ERROR: expression nestingWORD: )IN: evaluatorLINE: 1087FILE: "main source`
And this:

Code: [Select]
`Result = (IIF(RIGHT(Conc, 1)="S", 10, 20))`
Code: [Select]
`ERROR: Linker found unidentified names:1087 mid "main source"1100 mid "main source`

#### Brian Alvarez

• Hero Member
• Posts: 699
##### Re: Expression Nesting...
« Reply #1 on: February 20, 2020, 02:46:37 am »
If i add my own right function:

Code: [Select]
`ERROR: Linker found unidentified names:1090 right "main source"1103 right "main source`

#### Charles Pegge

• Posts: 4486
##### Re: Expression Nesting...
« Reply #2 on: February 20, 2020, 08:01:11 am »
Hi Brian,

Yes I see the problem of functions inside boolean-compare expressions.

Here is an alternative way:

Code: [Select]
`macro iif int(R,X,A,B)  if X    R=A  else    R=B  endifend macrostring s="qq"int resultresult = iif (ucase(s) = "QQ", 10, 20)print result '10`

#### Brian Alvarez

• Hero Member
• Posts: 699
##### Re: Expression Nesting...
« Reply #3 on: February 20, 2020, 01:54:35 pm »
The problem is that sometimes even the iif could be used inline. like this:

Code: [Select]
`result = iif (ucase(s) = "QQ", 10, 20) + xyz`
edit:
nevermind, it works. The more you know. How does thes macro works?
« Last Edit: February 20, 2020, 02:05:09 pm by Brian Alvarez »