Created
September 7, 2020 10:25
-
-
Save bennadel/14f20da867b0152208424e21eea4fd53 to your computer and use it in GitHub Desktop.
The Elvis / Null Coalescing Operator Can Sometimes Replace The Safe Navigation Operator In Lucee CFML 5.3.6.61
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
<cfscript> | |
echo( "Foo exists: " & variables.keyExists( "foo" ) ); | |
echo( ". " ); | |
echo( foo.bar.baz ?: "Null value fallback" ); | |
</cfscript> |
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
<cfscript> | |
echo( "Foo exists: " & variables.keyExists( "foo" ) ); | |
echo( ". " ); | |
echo( foo.bar.baz() ?: "Null value fallback" ); | |
</cfscript> |
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
<cfscript> | |
echo( foo().bar.baz ?: "Null value fallback" ); | |
// ------------------------------------------------------------------------------- // | |
// ------------------------------------------------------------------------------- // | |
public void function foo() { | |
// No-op. | |
} | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment