Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var readline = require('readline');
- var rl = readline.createInterface(process.stdin, process.stdout);
- console.log("Welcome! Enter 1 to continue, 0 to quit");
- rl.setPrompt('AceyDeucy> ');
- rl.prompt();
- rl.on('line', function(line) {
- if (line === "0") rl.close();
- rl.question("Enter a number", function(number){
- console.log(number);
- console.log("Enter 1 to play again, 0 to quit");
- rl.prompt();
- });
- }).on('close',function(){
- console.log("Thanks!");
- process.exit(0);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement