if then else shorthand a?b:c

Discuss Lemur and share techniques.
Post Reply
Softcore
Regular
Posts:1639
Joined:04 Nov 2012 08:34
if then else shorthand a?b:c

Post by Softcore » 13 Jan 2014 20:17

Is there a way to use a shorthand for if then (no else)....What if I dont want an "else" condition?

I tried simply entering a?b but pffffffff.....lol

Macciza
Regular
Posts:1325
Joined:07 Dec 2011 04:57
Location:Sydney, Australia.

Re: if then else shorthand a?b:c

Post by Macciza » 15 Jan 2014 05:18

Hi
There are some things the shorthand is suited to and other things it isn't - it not a straight drop in replacement . .
Though depending on what you are wanting to do, (and where?) there are ways to get around it

For example - try an expression x=a?b:x then Monitor x
x only changes if a is true and nothing seems to be returned else wise - does not return 0 ...
It seems to work - maybe the : ref to x just gets seen a false or null and nothing happens

Cheers
MM
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]

Softcore
Regular
Posts:1639
Joined:04 Nov 2012 08:34

Re: if then else shorthand a?b:c

Post by Softcore » 15 Jan 2014 08:24

Ahhh see, the most usual case where I've needed the shorthand is when setting a trigger for a custom message

So for example I want a custom message to be triggered by switch1.x only when switch2.x (a second object)

If I use as trigger:

switch2.x?switch1.x:0

then if previously switch1.x was 1, then even if switch2.x==0, we do have a trigger (switch1.x -> 0).

Post Reply