Skip to content

Instantly share code, notes, and snippets.

@ajcrites
Created December 16, 2015 18:14
Show Gist options
  • Save ajcrites/4e310ec49c2cec1a1551 to your computer and use it in GitHub Desktop.
Save ajcrites/4e310ec49c2cec1a1551 to your computer and use it in GitHub Desktop.
const readline = require("mz/readline");
const co = require("co");
const userId = "blarg";
co(function* () {
let rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
let answer = yield rl.question(`are you sure\nplease enter userId`);
if (answer === userId) {
let answer = yield rl.question(`danger bay was a good show`);
if ("y" === answer) {
return console.log("dead");
}
console.log("alive");
}
else {
console.log("user id is wrong");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment