Last active
March 11, 2018 20:04
-
-
Save Peregg/d916e63abcc8dcff7fb7f2f77fda3f88 to your computer and use it in GitHub Desktop.
WCS quest NodeJS
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
process.stdin.resume() | |
process.stdin.setEncoding('utf8') | |
console.log('Quel âge avez vous ?'); | |
process.stdin.on('data', (anneeDeNaissance) => { | |
if (anneeDeNaissance >= 1 && anneeDeNaissance <=99){ | |
console.log('Votre année de naissance est ' + (2018 - anneeDeNaissance)) | |
} else if (anneeDeNaissance == 0) { | |
console.log('Madame/Monsieur ! Vous devez être né pour utiliser ce programme ! Revenez quand vous aurez vu le jour !') | |
} else { | |
console.log('Vous devez vous être trompé(e) dans vôtre saisie, veuillez saisir un nombre entre 1 et 99') | |
} | |
process.exit() | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment