関数と制御式について

Kazunori Kamiya
Aug 29, 2017 · 2 min read

・Exercise35:関数と制御式

ここまでif文に関数、配列について学習してきました。
ひとまず以下のスクリプトを書いて実行して、何が起きているのか確かめてみてください。

出力結果について

以下のようになります。
ここでは、ゲームとして遊んでみました。

学習ドリル

  1. ゲームの流れを示したフローマップを作成してください。
  2. スペルミスを含め、全ての間違いを修正してください。
  3. 理解できない関数の部分にコメントを書いてください。
  4. もう少しゲームをいじってみてください。簡単にしても、より難しくしてもいいです。
  5. “gold_room”は数字を入力させるのに、変なやり方をしています。何がおかしいか。わかるでしょうか?ヒントは”=~”の使い方にあります。

学習ドリルの答え

  1. 以下のようになります。

5. 以下のように”gold_room”を修正してみました。

)
Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade