Skip to content

Commit

Permalink
updating docco to better reflect lack of explicit ternaries. Issue #510
Browse files Browse the repository at this point in the history
  • Loading branch information
jashkenas committed Jul 17, 2010
1 parent 6c8eab7 commit ec2d358
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
10 changes: 6 additions & 4 deletions documentation/index.html.erb
Expand Up @@ -43,7 +43,7 @@
<a href="#assignment">Assignment</a>
<a href="#objects_and_arrays">Objects and Arrays</a>
<a href="#lexical_scope">Lexical Scoping and Variable Safety</a>
<a href="#conditionals">Conditionals, Ternaries, and Conditional Assignment</a>
<a href="#conditionals">If, Else, Unless, and Conditional Assignment</a>
<a href="#aliases">Aliases</a>
<a href="#splats">Splats...</a>
<a href="#while">While, Until, and Loop</a>
Expand Down Expand Up @@ -434,15 +434,17 @@ coffee --print app/scripts/*.coffee > concatenation.js</pre>

<p>
<span id="conditionals" class="bookmark"></span>
<b class="header">Conditionals, Ternaries, and Conditional Assignment</b>
<b class="header">If, Else, Unless, and Conditional Assignment</b>
<b>If/else</b> statements can be written without the use of parentheses and
curly brackets. As with functions and other block expressions,
multi-line conditionals are delimited by indentation. There's also a handy
postfix form, with the <tt>if</tt> or <tt>unless</tt> at the end.
</p>
<p>
CoffeeScript will compile <b>if</b> statements using the ternary operator
when possible, to make it easier to use the result as an expression.
CoffeeScript can compile <b>if</b> statements into JavaScript expressions,
using the ternary operator when possible, and closure wrapping otherwise. There
is no explicit ternary statement in CoffeeScript &mdash; you simply use
a regular <b>if</b> statement inline.
</p>
<%= code_for('conditionals') %>
<p>
Expand Down
10 changes: 6 additions & 4 deletions index.html
Expand Up @@ -29,7 +29,7 @@
<a href="#assignment">Assignment</a>
<a href="#objects_and_arrays">Objects and Arrays</a>
<a href="#lexical_scope">Lexical Scoping and Variable Safety</a>
<a href="#conditionals">Conditionals, Ternaries, and Conditional Assignment</a>
<a href="#conditionals">If, Else, Unless, and Conditional Assignment</a>
<a href="#aliases">Aliases</a>
<a href="#splats">Splats...</a>
<a href="#while">While, Until, and Loop</a>
Expand Down Expand Up @@ -599,15 +599,17 @@ <h2>

<p>
<span id="conditionals" class="bookmark"></span>
<b class="header">Conditionals, Ternaries, and Conditional Assignment</b>
<b class="header">If, Else, Unless, and Conditional Assignment</b>
<b>If/else</b> statements can be written without the use of parentheses and
curly brackets. As with functions and other block expressions,
multi-line conditionals are delimited by indentation. There's also a handy
postfix form, with the <tt>if</tt> or <tt>unless</tt> at the end.
</p>
<p>
CoffeeScript will compile <b>if</b> statements using the ternary operator
when possible, to make it easier to use the result as an expression.
CoffeeScript can compile <b>if</b> statements into JavaScript expressions,
using the ternary operator when possible, and closure wrapping otherwise. There
is no explicit ternary statement in CoffeeScript &mdash; you simply use
a regular <b>if</b> statement inline.
</p>
<div class='code'><pre class="idle">mood<span class="Keyword">:</span> greatlyImproved <span class="Keyword">if</span> singing

Expand Down

0 comments on commit ec2d358

Please sign in to comment.