From GridLAB-D Wiki
Jump to: navigation, search

The #if macro is used to conditionally execute a block of GLM code only if the test succeeds.

Each #if macro must have a correspond #endif macro matching it in the same GLM file.


#if test
// conditional block

Tests are based on comparisons between values, such as comparing a variable to a number:

#if ${threadcount}>1
#print Running multithreaded mode


Prior to Hassayampa (Version 3.0)

The first term of the test was expanded as though it was a variable, e.g.,

#if VAR==1

was the same as

#if ${VAR}==1
As of Hassayampa (Version 3.0)

The expansion of the first term is deprecated and use of that syntax will cause a warning message to that effect.

See also