Skip to content

Commit cbbd45e

Browse files
author
David Brady
committed
Fixed liquid tyop
1 parent be11cff commit cbbd45e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

chapters/functions/parentheses.textile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@ h2. Solution
1313
Use parentheses anyway.
1414

1515
Another alternative is to utilise the do-notation like so:
16+
1617
{% highlight coffeescript %}
1718
notify = -> alert "Hello, user!"
1819
do notify if condition
1920
{% endhighlight %}
2021

2122
This compiles to the following JavaScript:
23+
2224
{% highlight javascript %}
2325
var notify;
2426
notify = function() {
@@ -27,7 +29,7 @@ notify = function() {
2729
if (condition) {
2830
notify();
2931
}
30-
{% endhiglight %}
32+
{% endhighlight %}
3133

3234
h2. Discussion
3335

@@ -36,4 +38,4 @@ Like Ruby, CoffeeScript allows you to drop parentheses to method calls. Unlike R
3638
Is this good or bad? It's just different. It creates an unexpected syntax case—parentheses aren't _always_ optional—but in exchange it gives you the ability to pass and receive functions fluently by name, something that's a bit klunky in Ruby.
3739

3840
This usage of the do-notation is a neat approach for CoffeeScript with parenphobia.
39-
Some people simply prefer to write out the parentheses in the function call, though.
41+
Some people simply prefer to write out the parentheses in the function call, though.

0 commit comments

Comments
 (0)