Skip to content

Instantly share code, notes, and snippets.

@adamcameron
Created December 12, 2013 15:50
Show Gist options
  • Save adamcameron/7930169 to your computer and use it in GitHub Desktop.
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
component {
variables.where = "in component";
{
public function hello() {
writeOutput(variables.where & "<br>");
return "Hello<br>";
}
}
}
<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