PDA

View Full Version : iif not as it used to be??


Donone
11-08-2008, 01:02 PM
x$=iif(a<b,3,4); gives 'cannot use in iif'. Changing to x$=iif(a<b;3;4); does not solve it.
Removing x$= removes the error. Surely this must return something.

Changing to if/else solves the problem of course, but what is wrong, does this no longer return a value?

kornalius
11-08-2008, 08:07 PM
Hi Donone,

Nice to see you back.

IIF has been changed a little while ago. I will have to look at my code again (which I don't have here with me) and get back to you.

kornalius
11-09-2008, 12:18 AM
Here is how it's working now:

a$ = 20;
IIF(a$ == 10; ShowMessage("10"); ShowMessage("20"));

First expression is evaluated, if true, execute expression 2 else expression 3.

So, you can do:

IIF(a$ > b$; a$ = 3; a$ = 4)

Donone
11-09-2008, 07:17 AM
Thank you Alain, nice to be back albeit intermittently, but I thought I ought to try to fix the reported error.
I refer you to the other post in Code Sharing - Working Class for PathSprite; to avoid duplication

http://forums.arianesoft.ca/showthread.php?t=1196&page=2

zehlein
11-27-2008, 08:41 PM
Hi Alain,
is there any way to make IIF accept
IIF(condition;statement1;);
instead of
IIF(condition;statement1;());

Those extra brackets look pretty weird.

kornalius
11-28-2008, 09:18 PM
I will take a look and try to come up with something.