Skip to content

#IFSAME

#IfSame

Purpose

The #IfSame command allows you to specify conditionally compiled code based on the comparison of a symbol to one or more literal values at compile-time.

Syntax

#IfSame {symbol} {value1} [{value2 ... valueN}]
{code to compile if symbol matches one of the values}
#Else
{code to compile if symbol does not match any of the values}
#EndIf

What It Does

#IfSame checks the value of the directive's first argument and compares it with the values that follow it on the directive line.

Each value should be separated by spaces from the next.

#IfSame !2 Group "OBJECT"

In this example, the second argument passed to the host macro is checked to see whether its value matches that of either the String variable Group or the string constant OBJECT. If the argument is found in the check list, the condition will evaluate to true, and commands following #IfSame will be compiled until the next #Else or #EndIf.