The KEYWORD_SET function returns a nonzero value if Expression is defined and nonzero or an array, otherwise zero is returned. This function is especially useful in user-written procedures and functions that process keywords that are interpreted as being either true (keyword is present and nonzero) or false (keyword was not used, or was set to zero).
Suppose that you are writing an IDL procedure that has the following procedure definition line:
PRO myproc, KEYW1 = keyw1, KEYW2 = keyw2
The following command could be used to execute a set of commands only if the keyword KEYW1 is set (i.e., it is present and nonzero):
IF KEYWORD_SET(keyw1) THEN BEGIN
The commands to be executed only if KEYW1 is set would follow.