Deja Brew
Singing with strings!
ストリングで歌う!
目標
Sing along.
一緒に歌いなさい。
You can concatenate(combine) strings with other strings,or numbers:
あなたは他のストリング、または数によって(結合)ストリングに連結できる:
var numberOfPotions = 5;
self.say("I have " + numberOfPotions + " potions.");
Use string concatenation to sing along with your friends!
あなたの友人とともに歌うために、ストリング連結を用いなさい!
ヒント
You can add strings together, and add numbers into strings.
Sing along, using string concatenation:
X potions of health on the wall!
X potions of health!
Take Y down, pass it around!
X-Y potions of health on the wall.
あなたはストリングを一緒に追加し、ストリングに数を追加できる。
一緒に、ストリング連結を使って歌いなさい:
壁の健康のX一服!
健康のX一服!
下にYを取りなさい。まわりのパスそれ!
壁の健康のX-Y一服。
解答
a
var potionsOnTheWall = 10;
var numToTakeDown = 1;
while(true) {this.say(potionsOnTheWall + " potions of health on the wall!");
this.say(potionsOnTheWall + " potions of health!");
this.say("Take 1 down, pass it around!");
potionsOnTheWall -= numToTakeDown;
this.say(potionsOnTheWall + " potions of health on the wall!");
a
- 最終更新:2016-03-23 01:20:38