How do I correctly format compound statements?
Can I require two expressions to be true to execute the clause?
10 IF A > B AND B < C THEN START FAN1
Can I execute the clause if only one expression is true?
10 IF A > B OR B < C THEN START FAN1
IF [ELSE] statements:
Can I use multiple else clauses?
10 IF A > B THEN START FAN1 , FAN_STAT = 1 ELSE STOP FAN1 , FAN_STAT = 0
How do I format more complex expressions? The brackets for math order of operations get removed in my program
I wrote this: 10 IF PW_SWT >= PROC_HSP - ( PRHT_DIF / 4 )
It was changed to this: 10 IF PW_SWT >= PROC_HSP - PRHT_DIF / 4
Can anyone share some examples of more complex IF statements so I can learn.
I have been using a Reliable Controls Control Basic Manual, but of course their implementation will be different. Local variables are an option, but I would like to understand what logical statements are accepted.
Multiple Statements within one IF stmt
This is an example of what I’m trying to implement:
10 IF PW_SWT >= PROC_HSP - PRHT_DIF / 4 OR NOT PROC_HT THEN DISABLE PROC_EHT , STOP PHPMPMAX
From the Manual:
Format: IF x THEN clause [ELSE clause]
Description: x is any expression, clause is a BASIC statement or sequence of statements (separated by commas) or a line number to branch to
If x is true (non zero), the clause following the THEN is executed. If x is false (zero), the clause after the ELSE is executed.