#21142 - 06/04/09 05:33 AM
Re: Use of Skip for performance
[Re: chewbarker]
|
Guy Lavoie
Beyond All Hope
   
Registered: 12/21/02
Posts: 6401
Loc: Montreal, QC, Canada
|
As you said, for just a few lines there is little advantage in skipping them, but for large groups of similar commands such as routines only executed when you're away from home, night routines, macros triggered only when IR is received, etc then you can improve not only performance but also make your code a lot cleaner (by using nested logic).
Yes, if the condition(s) test false as a complete logic test, then the THEN statements will not be executed (but they are not "skipped" as such, the program still needs to read it and see that it is a THEN statement).
I like using the SKIP TO statement to create C language-like code, just because of the familiarity with C logic flow. In the C language, the equivalent to the Skip To statement is (most often) the open brace "{". So if I wanted to do something like this in C:
if (away_mode == TRUE) { then do this then do that }
I will do this in C-Max:
IF V1-AwayMode = 1 ELSE Skip to line X THEN do this THEN do that (line x)
_________________________
"If you don't know what you're doing, do it neatly..."
|
|
Top
|
|
|
|
#21153 - 06/15/09 10:08 AM
Re: Use of Skip for performance
[Re: chewbarker]
|
Mike Chwojdak
journeyman
Registered: 01/15/03
Posts: 81
Loc: Rochester, NY
|
Guy, I didn't know you could put the ELSE before the THEN.
|
|
Top
|
|
|
|
#21155 - 06/15/09 05:11 PM
Re: Use of Skip for performance
[Re: Mike Chwojdak]
|
dahlheim
junior
Registered: 12/31/08
Posts: 41
|
me neither...
|
|
Top
|
|
|
|
#21867 - 06/05/10 12:43 PM
Re: Use of Skip for performance
[Re: Guy Lavoie]
|
Marty
newbie
Registered: 01/24/04
Posts: 23
Loc: Massachusetts, U.S.
|
Well that's easy to remember. I haven't modified my code in years, and I was poking around looking for a couple of coding nuggets. That info is just what the doctor ordered!
|
|
Top
|
|
|
|
Moderator: Dan Smith, Monte G, ADI Tech Support, Guy Lavoie
|
1 registered
(kuro)
and 21 anonymous users online.
|
|
2747 Members
19 Forums
3837 Topics
22714 Posts
Max Online: 67 @ 08/16/11 03:08 PM
|
|
|
|
|
|
1
|
2
|
3
|
4
|
|
5
|
6
|
7
|
8
|
9
|
10
|
11
|
|
12
|
13
|
14
|
15
|
16
|
17
|
18
|
|
19
|
20
|
21
|
22
|
23
|
24
|
25
|
|
26
|
27
|
28
|
29
|
|
|
|
|
|