the same null variable and its relationship to con ditional expressions

able (an empty vari able or a va cant vari able) In this sec tion, the same null variable and its relationship to con ditional expressions will


be evaluated Make sure to un der stand this sub ject well, it can help in many trou ble shoot ing sit u a –


tions Con di tional ex pres sions used with the IF and WHILE func tions (ex plained ear lier) al ways


com pare two val ues, us ing com par i son op er a tors such as EQ, NE, GT, LT, GE, and LE If a null vari able is com pared with an other value, the re turn value may be ei ther TRUE or FALSE, de pend –


ing on the ex act sit u a tion Com paring to a zero value is also shown, for more in-depth ref er ence


Copyright 2005, Industrial Press Inc, New York, NY –


FANUC CNC Custom Macros


BRANCHES AND LOOPS


183


A null vari able is dif fer ent than a vari able with a value of zero! As both the IF and the WHILE


func tions share the same logic, only the IF func tion is shown in the fol low ing ex am ples, be cause


the WHILE func tion uses the same for mat:


2 Comparing a null variable to a null variable:


#1 = #0


#1 is defined as null (that means #1 is vacant)


IF[#1 EQ #0]


Returns TRUE


IF[#1 NE #0]


Returns FALSE


IF[#1 GT #0]


Returns FALSE


IF[#1 GE #0]


Returns TRUE


IF[#1 LT #0]


Returns FALSE


IF[#1 LE #0]


Returns TRUE


2 Comparing a zero to a Dished Head Punching Machine null variable:


#1 = 0


#1 is defined as zero (that means #1 is equal to 0)


IF[#1 EQ #0]


Returns FALSE


IF[#1 NE #0]


Returns TRUE


IF[#1 GT #0]


Returns FALSE


IF[#1 GE #0]


Returns TRUE


IF[#1 LT #0]


Returns FALSE


IF[#1 LE #0]


Returns TRUE


2 Comparing a null variable to a zero:


#1 = #0


#1 is defined as null (that means #1 is vacant)


IF[#1 EQ 0 ]


Returns FALSE


IF[#1 NE 0]


Returns TRUE


IF[#1 Angle Punching GT CNC Angle Line 0]


Returns FALSE


IF[#1 GE 0]


Returns TRUE


IF[#1 LT 0]


Returns FALSE


IF[#1 LE 0]


Returns TRUE


2 Comparing a zero to a zero:


#1 = 0


#1 is defined as zero (that means #1 is equal to 0)

Tags: , ,

No Comments

rssComments RSS   transmitTrackBack Identifier URI

No comments. Be the first.

addLeave a comment