mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
subliminally promoting the use of interpolation in the documentation
This commit is contained in:
parent
6f64fc266d
commit
d3e809da38
9 changed files with 9 additions and 11 deletions
|
@ -8,4 +8,4 @@ if car.speed < limit then accelerate()
|
|||
|
||||
winner = yes if pick in [47, 92, 13]
|
||||
|
||||
print inspect "My name is " + @name
|
||||
print inspect "My name is #{@name}"
|
||||
|
|
|
@ -2,7 +2,7 @@ class Animal
|
|||
constructor: (@name) ->
|
||||
|
||||
move: (meters) ->
|
||||
alert @name + " moved " + meters + "m."
|
||||
alert @name + " moved #{meters}m."
|
||||
|
||||
class Snake extends Animal
|
||||
move: ->
|
||||
|
|
|
@ -2,6 +2,6 @@ alert(
|
|||
try
|
||||
nonexistent / undefined
|
||||
catch error
|
||||
"And the error is ... " + error
|
||||
"And the error is ... #{error}"
|
||||
)
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
yearsOld = max: 10, ida: 9, tim: 11
|
||||
|
||||
ages = for child, age of yearsOld
|
||||
child + " is " + age
|
||||
"#{child} is #{age}"
|
||||
|
|
|
@ -6,5 +6,5 @@ if this.studyingEconomics
|
|||
# Nursery Rhyme
|
||||
num = 6
|
||||
lyrics = while num -= 1
|
||||
num + " little monkeys, jumping on the bed.
|
||||
"#{num} little monkeys, jumping on the bed.
|
||||
One fell out and bumped his head."
|
||||
|
|
|
@ -12,7 +12,7 @@ Animal = (function() {
|
|||
this.name = name;
|
||||
}
|
||||
Animal.prototype.move = function(meters) {
|
||||
return alert(this.name + " moved " + meters + "m.");
|
||||
return alert(this.name + (" moved " + meters + "m."));
|
||||
};
|
||||
return Animal;
|
||||
})();
|
||||
|
|
|
@ -2,9 +2,7 @@ var footprints, solipsism;
|
|||
if ((typeof mind !== "undefined" && mind !== null) && !(typeof world !== "undefined" && world !== null)) {
|
||||
solipsism = true;
|
||||
}
|
||||
if (typeof speed !== "undefined" && speed !== null) {
|
||||
speed;
|
||||
} else {
|
||||
if (typeof speed === "undefined" || speed === null) {
|
||||
speed = 75;
|
||||
};
|
||||
footprints = typeof yeti !== "undefined" && yeti !== null ? yeti : "bear";
|
|
@ -9,7 +9,7 @@ ages = (function() {
|
|||
_results = [];
|
||||
for (child in yearsOld) {
|
||||
age = yearsOld[child];
|
||||
_results.push(child + " is " + age);
|
||||
_results.push("" + child + " is " + age);
|
||||
}
|
||||
return _results;
|
||||
})();
|
|
@ -12,7 +12,7 @@ lyrics = (function() {
|
|||
var _results;
|
||||
_results = [];
|
||||
while (num -= 1) {
|
||||
_results.push(num + " little monkeys, jumping on the bed. One fell out and bumped his head.");
|
||||
_results.push("" + num + " little monkeys, jumping on the bed. One fell out and bumped his head.");
|
||||
}
|
||||
return _results;
|
||||
})();
|
Loading…
Reference in a new issue