Jump to content
C4 Forums | Control4

Whether or not to use ELSE


ILoveC4

Recommended Posts

Can someone comment on why you'd chose to do one of these over the other? It seems they both accomplish the same thing. I've never really leveraged "Else" in Control4. Just wondering if there's a reason why one would use one of these examples over the other, assuming they didn't mind the "STOP" command from killing the script from continuing.

image.png.20433755dc4d3b19b5b4425c2fe9e650.png

 

image.png.581e74b63bed152d32d0de61c661af67.png

Link to comment
Share on other sites


Take a quick peek at the two images you have sent.

Which one can be accomplished in the least amount of clicks?

For the sake of time and characters onscreen, I feel you have your own answer.

PS. This is mike. Vince’s partner. I have taken over VINCELdUB’s postings as he is no longer here.

Link to comment
Share on other sites

On 4/6/2020 at 5:55 PM, VINCELdUB said:

Take a quick peek at the two images you have sent.

Which one can be accomplished in the least amount of clicks?

For the sake of time and characters onscreen, I feel you have your own answer.

PS. This is mike. Vince’s partner. I have taken over VINCELdUB’s postings as he is no longer here.

No longer here but will be back? Or no longer working with you?

Link to comment
Share on other sites

On 4/6/2020 at 5:37 PM, ILoveC4 said:

Can someone comment on why you'd chose to do one of these over the other? It seems they both accomplish the same thing. I've never really leveraged "Else" in Control4. Just wondering if there's a reason why one would use one of these examples over the other, assuming they didn't mind the "STOP" command from killing the script from continuing.

image.png.20433755dc4d3b19b5b4425c2fe9e650.png

 

image.png.581e74b63bed152d32d0de61c661af67.png

Apart from number of clicks, the else route avoids strange behavior if the variable (power state in your case) changes milliseconds after you start running the code.

Link to comment
Share on other sites

  • 3 weeks later...

Additionally, you might want to execute some more commands later in the script, i.e., after the if-else block, regardles of which branch (if-else) was chosen. It's not possible with the 'Stop' command (unless you duplicate those commands before each Stop). The script just ends there.

Link to comment
Share on other sites

He already made the assumption the stop command wasn't an issue.

Also the second stop is redundant.

 

But yes the biggest point would be to stopping the overall script (or having to build in more layers of programming.

It's functional use is limited beyond that (as frankly, it would only be one line less to program, assuming you even need a stop command for the programming.

 

It IS more in line with common programming languages, and if you're using it in extensive macros, it makes it easier to track 'sections' of programming.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.