1
0
Fork 0
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:
Michael Ficarra 2011-06-08 19:38:12 -04:00
parent 6f64fc266d
commit d3e809da38
9 changed files with 9 additions and 11 deletions

View file

@ -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}"

View file

@ -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: ->

View file

@ -2,6 +2,6 @@ alert(
try
nonexistent / undefined
catch error
"And the error is ... " + error
"And the error is ... #{error}"
)

View file

@ -1,4 +1,4 @@
yearsOld = max: 10, ida: 9, tim: 11
ages = for child, age of yearsOld
child + " is " + age
"#{child} is #{age}"

View file

@ -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."

View file

@ -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;
})();

View file

@ -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";

View file

@ -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;
})();

View file

@ -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;
})();