Created
October 3, 2012 20:33
-
-
Save ChandraNalaani/3829683 to your computer and use it in GitHub Desktop.
Drink More Water (javascript)
This file contains 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
// a node.js command line program | |
var rl = require('readline'); | |
// requires node's readline module | |
var prompts = rl.createInterface(process.stdin, process.stdout); | |
prompts.question("How many 8oz glasses of water have you had today? ", function (glasses) { | |
var message = ''; | |
if (glasses < 8) { | |
message = glasses + " glasses of water isn't enough. You need at least 8 8oz glasses of water every day for your brain and body to function at its best. Drink at least " + (8 - glasses) + " more."; | |
} else { | |
message = "Excellent! Keep up the good work."; | |
} | |
console.log(message); | |
process.exit(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment