Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions AreYouOk/AreYouOk.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
var readlineSync = require('readline-sync');

async function main () {
console.log("Oh, hey there, are u ok buddy?");
let answer = ""
do {
answer = readlineSync.question();
if(answer != 'y' && answer != 'n'){
invalidAnswer();
}
} while ((answer !== 'y') && (answer !== 'n'));
if (answer == 'n') {
console.log("You're definitely not ok.\n");
console.log("Go there right now, you don't know what you're missing\n");
}else if (answer == 'y'){
console.log("Oh! Nice\n");
console.log("Aren't they cute?\n");
do {
answer = readlineSync.question();
if(answer != 'y' && answer != 'n'){
invalidAnswer();
}
} while (answer != 'y' && answer != 'n');
if (answer == 'n') {
console.log("You're definitely not ok.\n");
}
else if(answer == 'y') {
console.log(":D\n");
console.log("Well, everything actually seens ok with you\n");
}
}
}
main()

function invalidAnswer() {
console.log("Oh, I didn't understand you :(\nsay 'y' for yes or 'n' for no\n");
}
37 changes: 37 additions & 0 deletions AreYouOk/AreYouOk.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
var readlineSync = require('readline-sync');

async function main () {
console.log("Oh, hey there, are u ok buddy?");
let answer = ""
do {
answer = readlineSync.question();
if(answer != 'y' && answer != 'n'){
invalidAnswer();
}
} while ((answer !== 'y') && (answer !== 'n'));
if (answer == 'n') {
console.log("You're definitely not ok.\n");
console.log("Go there right now, you don't know what you're missing\n");
}else if (answer == 'y'){
console.log("Oh! Nice\n");
console.log("Aren't they cute?\n");
do {
answer = readlineSync.question();
if(answer != 'y' && answer != 'n'){
invalidAnswer();
}
} while (answer != 'y' && answer != 'n');
if (answer == 'n') {
console.log("You're definitely not ok.\n");
}
else if(answer == 'y') {
console.log(":D\n");
console.log("Well, everything actually seens ok with you\n");
}
}
}
main()

function invalidAnswer() {
console.log("Oh, I didn't understand you :(\nsay 'y' for yes or 'n' for no\n");
}