-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
39 lines (37 loc) · 874 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import inquirer from "inquirer";
let todos:string[]=[];
let loop = true;
while(loop){
const answers:{
ToDo:string,
addmore:boolean
}=await inquirer.prompt([
{
type:"input",
name:"ToDo",
message:"What do you want to add in your To DO list?"
},
{
type:"confirm",
name:"addmore",
message:"Do you want to add more in your To Do?",
default:false
}
])
const{ToDo,addmore}=answers;
console.log(answers)
loop = addmore
if(ToDo){
todos.push(ToDo)
}else {
console.log("Kindly add valid input")
}
}
if(todos.length>0){
console.log("Your To Do list :\n")
todos.forEach(todo=>{
console.log(todo)
})
}else{
console.log("No ToDOs Found!")
};