Created
June 18, 2020 17:20
-
-
Save l-gu/14e411c82ec643fa5ce117423eef49eb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- Playing with defined/undefined variables | |
#set ( $FOO1 = "FooValue1" ) | |
'FOO1' variable has been set, value = "$FOO1" | |
#if ( $fn.isDefined("FOO1") ) ## Check by variable name (string, not object reference) | |
YES 'FOO1' is defined | |
#else | |
NO 'FOO1' is not defined | |
#end | |
## Check with 'assert' directive (causes an error if not true) | |
#assertTrue($fn.isDefined("FOO1"), "F001 is not defined!") | |
#if ( $fn.isDefined("model") ) | |
YES, the "model" object is always defined in a Telosys template | |
#end | |
--- Getting an object value with a default value if not defined | |
#assertFalse($fn.isDefined("FOO2"), "F002 is not supposed to be defined!") | |
Getting "FOO2" : $fn.get("FOO2", "my default value") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment