Lorne,
TBASIC is a TRI's programming language has syntax that is close to many other BASIC languages.
Your question about the use of delimiters is a very valid one to ask. First I must remind you that ":" is only one of many delimiters used by TBASIC. The other delimiters are ASCII spaces, ASCII tabs and ASCII newline characters.
The purpose of a delimiter is to allow the TBASIC compiler to be able to break the program you have written down into bits of stuff that can be understood.
Your first program statement:
IF A>B THEN
THEN C=D*5
ELSE
C=D/5
ENDIF
Is not written correctly and cannot be compiled. You are still holding on to the use of the "THEN" that I have corresponded with you about earlier. There is no reason to use "THEN" in TBASIC . The use of "THEN" is 100% optional, however the use of THEN twice in row is 100% wrong.
First get rid of both "THEN" keywords. Your program snippet will compile:
IF A>B
C=D*5
ELSE
C=D/5
ENDIF
I have marked the delimiters in red for your programming snippet. __ is where you used an ASCII space(s) as a delimiter and <CR> is where you you used an ASCII newline as a delimiter.
IF__A>B<CR>
__C=D*5<CR>
ELSE<CR>
__C=D/5<CR>
ENDIF<CR>
You will notice that you have several delimiters in a row. You can make this program "smaller" by eliminating the extra delimiters. This is about as small as you can make your programming snippet:
IF_A>B_C=D*5_ELSE_C=D/5_ENDIF<CR>
OR (without the delimiter highlighting):
IF A>B C=D*5 ELSE C=D/5 ENDIF
Your shortened snippet will not compile as you used "IS" rather than "IF":
IS A>B: C=D*5:ELSE:C=D/5:ENDIF
OK, what about the ":" delimiter? In many BASIC dialects the ":" was used to allow one to place multiple statements on a single line of code. In TBASIC you can get this done with the use of the ASCII space. I am not certain when or if the ":" delimiter is ever required by TBASIC. However, If I wanted to put the following code on a single line, I might use the ":" to remind me of the statement boundaries:
IF A>B
C=D*5
SetIO BIT0
ELSE
C=D/5
ClrIO BIT0
ENDIF
Could be written as:
IF A>B C=D*5 : SetIO BIT0 ELSE C=D/5 : ClrIO BIT0 ENDIF
I added the " : " between the statements to make it a bit easier to read. Please note that I am using " : " as the delimiter rather than ":" as some versions of the i-TriLOGI do not consistently recognize ":" as a delimiter. TRI is aware of this and may be fixed this problem in future releases.
Your last question about:
IF SUMCV >= 27 SETIO SUCT27 ELSE CLRIO SUCT27
You have supplied all of the delimiters required by TBASIC. This code will compile and it will execute as you expect.
The key things to think about is this, "If you write code with litter or no structure, will you be able to understand or maintain this code in the future?"
Best regards,
Gary D*ckinson