Created
June 18, 2020 17:22
-
-
Save l-gu/72e062491b0e069d5e3ce0c456ed1bdd 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
--- 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") | |
--- Defining a variable if not already exists | |
Exemple 1 : | |
'NAMESPACE' has not been defined in the project variables | |
then it will be initialized with a default value | |
#set ( $NAMESPACE = $fn.get("NAMESPACE", "default-name" ) ) | |
NAMESPACE = $NAMESPACE ## "default-name" (initialized) | |
Exemple 2 : | |
'AUTHOR' variable is already defined so it remains unchanged | |
#set ( $AUTHOR = "Bart" ) | |
#set ( $AUTHOR = $fn.get("AUTHOR", "Homer" ) ) | |
AUTHOR = $AUTHOR ## "Bart" (unchanged) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment