Recommendations (not rules)

Note: some examples in this documentation don't fully follow these rules - they were taken from other sources or it's done intentionally to illustrate some language features.

       CRT '"Yes Minister", ' : "that's what I said."
       var_1 = 1  ;  var_2 = 2  ;  var_3 = 3

Instead of:

       IF INDEX(...) THEN

always write:

       IF INDEX(...) NE 0 THEN

Same goes for strings. Instead of:

       var = 'ABC'
       IF var THEN  ;* code continues here

Use:

       IF var NE '' THEN  ;* code continues here
       current_date = DATE()
       current_day = OCONV(current_date, 'DD')
       current_month = OCONV(current_date, 'DM')
       ansi_date =  OCONV(current_date, 'DY') : '-'    \
             : FMT(current_month, 'R0%2' )   : '-'     \
             : FMT(current_day, 'R0%2' )
       CRT ansi_date                             ;* e.g. 2013-03-08
       001 A = 0
       002 A += 1
       003 IF A LT 5 THEN GOTO 002 ELSE CRT A
       var_1 = 1  ; var_2 = 2  ; var_3 = 3 ; var_4 = 4
       IF var_1 EQ 1 OR var_2 EQ 20 AND var_3 EQ 30 OR var_4 EQ 40 THEN CRT 1
       IF var_1 EQ 1 OR (var_2 EQ 20 AND var_3 EQ 30 OR var_4 EQ 40) THEN CRT 2
       IF (var_1 EQ 1 OR var_2 EQ 20) AND (var_3 EQ 30 OR var_4 EQ 40) THEN CRT 3

(See the second example in chapter "Other notes".)

Last update: Sat, 16 Jul 2022 15:34