Last active
August 29, 2015 14:03
-
-
Save omas/40b83a2135be438c0be9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <!-- | |
| 1.コマンドラインに入力を待ち受けるための「>」を表示する。 | |
| 2.標準入力された値があればそのまま表示、値がなければ「未入力です」と表示して、再び入力待ち受け状態にする。 | |
| 3.「EXIT」が入力された時点でプログラムを終了する。 | |
| --> | |
| <script> | |
| (function(){ | |
| while(true){ | |
| var input = prompt(">"); //condition 1 | |
| if (input === "EXIT") break; //condition 3 | |
| if (input) { //condition 2 | |
| output(input); | |
| } else { | |
| output("未入力です"); | |
| } | |
| } | |
| })(); | |
| function output(text){ | |
| alert(text); | |
| } | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment