Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

EXIT Statement

EXIT Statement is used to escape from the all kinds of repetitive statements before it ends. When EXIT statement is performed, the nearest repetitive statement is cancelled.

Example

Description

// WHILE statement is performed while D00’s value is less than 10.

// If D00’s value is greater than 5, the syntaxes in IF statement will be performed,

// which will assign 10 to D00 and exit the repetitive statement.

WHILE DW00 < 10 DO

   IF DW00 > 5 THEN

       DW00 := 10;

       EXIT;

   END_IF;

   DW10 := DW10 + DW00;

   DW00 := DW00 + 1;

END_WHILE;

RETURN Statement

RETURN Statement is used to terminate the program in ST program while it’s running.
When RETURN Statement is performed, the syntaxes that follows RETURN statement will be ignored and the process will jump from the RETURN statement to the last part of the ST program.

Example

Description

// If D0’s value is greater than 5, assign 10 to D0 and end.

// The IF Statement in the below satisfies the condition that D0 is equal to 10, but will not be performed because of RETURN

IF DW00 > 5 THEN

   DW00 := 10;

   RETURN;

END_IF;

IF DW00 = 10 THEN

   DW10 := 100;

END_IF;

Comment

Comment makes the ST program more understandable and readable. The comments are not compiled and does not affect the program.
Only one line is allowed in each comments and Korean characters can be used.
// : Annotate all text in that line after that phrase.
(* ) : Annotate all text between ( and *) phrases, regardless of line.

Example

Description

// The syntax below is annotated.

// MX01 := 1;

Description

// The all syntax below is annotated.

(* MX01 := 1;

MX02 := 2;

MX03 := 3;

MX04 := 4; *)

  • No labels