Created
December 12, 2013 15:50
-
-
Save adamcameron/7930169 to your computer and use it in GitHub Desktop.
Demonstrating that curly brace thing. The code below outputs: in component
Hello
calling code
Hello If it was using closure, it would continue to say "in component". HTH
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
component { | |
variables.where = "in component"; | |
{ | |
public function hello() { | |
writeOutput(variables.where & "<br>"); | |
return "Hello<br>"; | |
} | |
} | |
} |
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> | |
junk = new Junk(); | |
writeOutput(junk.hello()); | |
writeOutput("<hr>"); | |
hello = junk.hello; | |
where = "calling code"; | |
writeOutput(hello()); | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment