Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #34

Merged
merged 3 commits into from Jul 13, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 16 additions & 16 deletions cfml100mins.markdown
Expand Up @@ -909,44 +909,44 @@ ColdFusion did not have a way of referring to nothingness until version 9. ColdF

If you have three eggs, eat three eggs, then you might think you have *nothing* , but in terms of eggs you have "0". Zero is something, it's a number, and it's *not nothing*.

A large percentage of the errors you encounter while writing CFML code will involve a variable not existing. You thought something was there, you tried to do something to it, and you can't do something to nothing so CFML creates an error. Lets rewrite our ```makeeggs``` method to illustrate "NULL" :
A large percentage of the errors you encounter while writing CFML code will involve a variable not existing. You thought something was there, you tried to do something to it, and you can't do something to nothing so CFML creates an error. Lets rewrite our ```makeEggs``` method to illustrate "NULL" :

#### Tag

```cfm
<cffunction name="makeeggs" returnType="component">
<cffunction name="makeEggs" returnType="component">
<cfargument name="quantity" type="numeric">
<cfif (IsNull(arguments.quantity)) />
<cfset this.makeEggs = "How am I supposed to make nothingness number of eggs?" />
<cfset local.makeEggs = "How am I supposed to make nothingness number of eggs?" />
<cfelse>
<cfset this.makeEggs = "Making your #arguments.quantity# eggs!" />
<cfset this.yourEggs = ArrayNew(1) />
<cfset local.makeEggs = "Making your #arguments.quantity# eggs!" />
<cfset local.yourEggs = ArrayNew(1) />

<cfloop condition="#ArrayLen(this.yourEggs)# LT #arguments.quantity#">
<cfset ArrayAppend(this.yourEggs, "Making an Egg.") />
<cfloop condition="#ArrayLen(local.yourEggs)# LT #arguments.quantity#">
<cfset ArrayAppend(local.yourEggs, "Making an Egg.") />
</cfloop>
</cfif>
<cfreturn this />
<cfreturn local />
</cffunction>
```

#### Syntax

```cfm
public component function makeeggs (numeric quantity){
public component function makeEggs (numeric quantity){
if (IsNull (arguments.quantity)) {
this.makeEggs = "How am I supposed to make nothingness number of
local.makeEggs = "How am I supposed to make nothingness number of
eggs?";
} else {
this.makeEggs = "Making your #arguments.quantity# eggs!";
this.yourEggs = ArrayNew (1);
while (ArrayLen (this.yourEggs) < arguments.quantity)
ArrayAppend (this.yourEggs, "Making an Egg.");
local.makeEggs = "Making your #arguments.quantity# eggs!";
local.yourEggs = ArrayNew (1);
while (ArrayLen (local.yourEggs) < arguments.quantity)
ArrayAppend (local.yourEggs, "Making an Egg.");
}
return this;
return local;
}
```

Reload the file, call ```frank.makeeggs(3)``` then try ```frank.makeeggs()```.
Reload the file, call ```frank.makeEggs(3)``` then try ```frank.makeEggs()```.

**TODO: Conclusion**
2 changes: 2 additions & 0 deletions readme.markdown
Expand Up @@ -22,6 +22,8 @@ Daniel Short (@danshort on twitter) * [http://www.dansshorts.com](http://www.dan

Craig Kaminsky (@craigkaminsky on twitter) * [http://craigkaminsky.me](http://craigkaminsky.me)

Daniel Sellers (@daniel_sellers on twitter) * [http://designfrontier.net](http://designfrontier.net)

## Git Workflow for Contributors

This project uses the excellent [Git Workflow series](http://www.silverwareconsulting.com/index.cfm/Git-Workflow) by [Bob Silverburg](https://github.com/bobsilverberg/) for contributions.
Expand Down