6-81
6 Programming
NJ-series CPU Unit Software User’s Manual (W501)
6-5 Programming Languages
6
6-5-3 Structured Text Language
CASE Case CASE f OF
1: g :=11;
2: g :=12;
ELSE g :=0;
END_CASE;
FOR For FOR i: = 100 TO 1 BY -1 DO
Val[ i ] := i;
END_FOR;
WHILE While WHILE Val < MaxVal DO
Val := Val + 1;
END_WHILE;
REPEAT Repeat REPEAT
Val := Val + 1;
UNTIL( Val > 4 )
END_REPEAT;
EXIT Exit the loop. FOR i := 1 TO 100 DO
FOR j := 1 TO 10 DO
IF Val[ i, j ]>100 THEN EXIT;
END_IF;
END_FOR;
END_FOR;
; Empty statement Val[ i ] := i
; (* Empty statement *)
WHILE(Var <>0) DO
; (* Empty statement *)
END_WHILE;
(* Text *) Comments (* Commenting out multiple lines
IF MyFun (ErrorCode) = 3
THEN ReturnValue := GetDetail();
END_IF;
down to here. *)
//Text Comment A := SIN( X ) ^ 2 + COS ( Y ) ^2 + 10;
// A := SIN( X ) ^ 2 + COS ( Y ) ^2 + 5;
Keyword Meaning Example