TransEra HTBasic Syntax

HTBasic is the languange used by Trans Era, aiming for measurement equipment controlling usages.

However, it is different from normal programming languages, there are specific syntax and kind of bugs when you code.

Loop Conditions

While

1
2
3
WHILE condition
...
END WHILE

For

1
2
3
FOR X=1 TO N [STEP 1]
...
NEXT X

If STEP is not specified, default step value is 1.

Loop

1
2
3
4
5
LOOP
...
[EXIT IF condition]
...
END LOOP

EXIT IF stops and breaks the loop.

Subprogram & Function

Subprogram can take parameters and does not return value. Function can also use parameters and return an INTEGER or a STRING.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
! Main Program
...
Area = FNSquare(Side)

CALL Your_sub_name(@4156, Count, Numbers(*), Out$)
PRINT FNRepeat_char$("-", 50)
END

SUB Your_sub_name(@meter, I, Arr(*), Str$)
...
SUBEND

DEF FNSquare(I)
RETURN I*I
FNEND

DEF FNRepeat_char$(C$, I)

FNEND

Sometimes syntax error appears even if there is no syntax error, when this happen, copy all of your codes to a new file and save. That's it.

分享到 評論