Jump to content

Case Statement


C Martin

Recommended Posts

Posted

Is there a possibility that we can get a Case Statement in our Programing Toolbox?

It is much more powerful and flexible that the If statement. This is not in lieu of the If statement.

Posted
Is there a possibility that we can get a Case Statement in our Programing Toolbox?

It is much more powerful and flexible that the If statement. This is not in lieu of the If statement.

 

The switch-case constructs that I'm familiar with are useful only if the language has variables. I'm assuming that this request is related to your other request for variables? Or, is there an example of a case statement that would be useful in the current ISY programming language without variables?

Posted

You are indeed correct - this would require the use of variables.

Even if we didn't have a case statement, I think variables would still be a great addition.

Posted

Don't you think of Status as a variable? True/False states are also variables, correct? And Time?

 

If 
   Time is 12:00:00PM

Then
   Select Status 'MBRM'
       Case Off
           Set 'Fireplace' Off

       Case <30%
           Set 'Fireplace' Off

       Case On
           Set 'Fireplace' On

   EndSelect

Else
  - No Actions - (To add one, press 'Action')



 

Rand

Posted

In this example, Status is more like a function than a variable. I.E., Status(MBRM) is evaluated and it is the return value that causes the appropriate branch to be taken. You wouldn't see an assignment like Status 'MBRM' = xxx.

 

Nevertheless, your example illustrates that a switch-case construct would be useful even if ISY-speak doesn't have variables.

Posted

Rand,

 

I could accept using the Status flag.

I guess I didn't think about that, but I'm sure that I would have gotten around to it eventually.

Good example.

 

Clarence

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...