Forum

Please note that you can subscribe to the individual forums. A subscription for news only covers the news.

Notifications
Clear all

WhenNot, WhenNone!

   RSS

0
Topic starter

Hello

Minor suggestion regarding WhenNot cases. It would be handy to be able to express a compound WhenNot condition in one line so it is equal to a stack of WhenNot followed by When=All.

My understanding is that WhenNot=A,B,C is any contradiction to When=A,B,C. So it’s equal to

   Whennot=A
   Whennot=B
   Whennot=C
   When=Any

What would sometimes be useful is a single-line case that is equal to the stack followed by When=All. Something like

WhenNone=A,B,C

Challenges arise because the When=All /Any etc statements apply to all earlier conditions in the series.

Hope this makes sense and that I haven’t missed something. Of course, there's always a way of doing things with the existing options, which are just great!  😜 

5 Answers
0

Hi Simon,

As a programmer I really do understand the challenge. However, it is not as minor as you might think.

In When and WhenNot I use the same logic as in If and NotIf. So WhenNot=A,B,C is more like

When=A
When=B
When=C
When=None
  (this is executed)

The problem is that though you can have more lines of If and NotIf, you only have one line of When or WhenNot available.

Unfortunately, to fix that, I would need to implement logic with and and or. And that is very complicated to do. So it is not where I think I should invest my time.

So I am sorry that I cannot fulfil this request. But please be aware that you can have nested case statements. That may help in some situations.

Sven

 

0
Topic starter

Thanks for your response, Sven. Of course you understood – and there’s me labouring away like I'm explaining long division to a Labrador. I have some idea what you’re saying about ‘and’ and ‘or’, or ‘and or’, but I can’t comment. Conditionals fry my noodle. Speaking of which, nested cases sound interesting. I imagine that's the technique you pointed out a while back...  case-within-case. Invaluable! Or is it another system that I’m unaware of?

Case=First
When=A
        Case=First
               When=B
         Case=End
Case=End

0

Yes, this is what I was thinking of.

What I was trying to say, was that I can't find a simple syntax that would suit all needs. So there has to be some limitations.

Sven

0
Topic starter

Hi Sven

Thanks for confirming. I am going to risk contradicting you, but just for clarity. You say:

WhenNot=A,B,C is more like
When=A
When=B
When=C
When=None

Either I’m misunderstanding, or I disagree. I intuitively expected WhenNot=A,B to mean not A and not B (i.e., none of A and B). But a statement governed by WhenNot=A,B executes when Not A and/or Not B (I.e., when not all of A and B). So it seems more like

When=A
When=B
When=NotAll

Which is about equal to

Whennot=A
Whennot=B
When=Any

It’s the same with NotIf=A,B. This is not strictly relevant to the inquiry. Whatever the statement means, the crucial matter is being able to express it in one line. I guess your conclusion stands: there's no syntax to suit all needs. I mean, sometimes in one line we want ‘and’ and sometimes ‘or’. Seems we get ‘and’ for positives and ‘or’ for negatives.

To spell it out, I contend that these have similar effect:

WhenNot=A,B

Whennot=A
Whennot=B
When=Any

When=A
When=B
When=NotAll

 

And these:

When=A,B

When=A
When=B
When=All

Whennot=A
Whennot=B
When=None

0

If you have tested it, you are undoubtedly right. I just looked in the manual (under If and NotIf, because it is the same mechanism). But the manual may be wrong.

Sorry for the confusion.

I do not have time to go deeper into it now, so I will accept your tests and not do further.

Sven