beautypg.com

Else, Program flow – Yaskawa LEGEND-MC User Manual

Page 113

background image

103

LEGEND-MC User’s Manual

ELSE

[Program Flow]

DESCRIPTION:

The ELSE command is an optional part of an IF conditional statement. The ELSE command must occur
after an IF command and it has no arguments. It allows for the execution of a command only when the
argument of the IF command evaluates False. If the argument of the IF command evaluates false, the
controller will skip commands until the ELSE command. If the argument for the IF command evaluates
true, the controller will execute the commands between the IF and ELSE command.

ARGUMENTS: none

USAGE:

RELATED COMMANDS:

EXAMPLES:

While Moving

Yes

Default Value

---

In a Program

Yes

Default Format

---

Command Line

No

Distributed Control

No, Local

"ENDIF"

End of IF conditional Statement

IF (@IN[1]=0)

IF conditional statement based on input 1

IF (@IN[2]=0)

2

nd

IF conditional statement executed if 1

st

IF

conditional true

MG "INPUT 1 AND INPUT 2 ARE
ACTIVE"

Message to be executed if 2

nd

IF conditional is

true

ELSE

ELSE command for 2

nd

IF conditional

statement

MG "ONLY INPUT 1 IS ACTIVE

Message to be executed if 2

nd

IF conditional is

false

ENDIF

End of 2

nd

conditional statement

ELSE

ELSE command for 1

st

IF conditional

statement

MG"ONLY INPUT 2 IS ACTIVE"

Message to be executed if 1

st

IF conditional

statement

ENDIF

End of 1

st

conditional statement