How to use the questionInt function from readline-sync

Find comprehensive JavaScript readline-sync.questionInt code examples handpicked from public code repositorys.

-2
-1
console.log
(`Olá, ${name}. Obrigado por fornecer sua idade: ${age} e seu emaiL: ${email} ` );
fork icon1
star icon7
watch icon0

-2
-1
let password = read.questionNewPassword('Enter password: ');
console.log(`Name = ${name}, age = ${age}, amount = ${amount}, password = ${password}`);
fork icon1
star icon2
watch icon0

0
1
2
3
4
5
6
7
8
9
let input = require("readline-sync");
// accept strings
let name = input.question("Enter name: ");
console.log(`Hi ${name}`);
// accept numbers
let age = input.questionInt("Enter age: ");
console.log(`Hi ${name}, your age is ${age}`);
// accept password
let pass = input.questionNewPassword("Enter password: ");
console.log(`Password is: ${pass}`)
fork icon1
star icon2
watch icon0

+ 3 other calls in file

-1
console.log(`Hello ${username}, you entered password: ${password} and phone: ${phone}`);
fork icon2
star icon0
watch icon0

70
71
72
73
74
75
76
77
78
79
while(test <= 0 || test > 100) test = rl.questionInt('Quantos testes deseja fazer? ');
console.log('\n');

for(let i = 0; i < test; i++){
    let S = P = 0;
    while(S <= 0 || S > 1018) S = rl.questionInt(`Quantas cabines tem no teste ${i+1}? `);
    while(P <= 0 || P > S) P = rl.questionInt(`Quantas pessoas estão na fila do banheiro no teste ${i+1}? `);
    console.log('\n');
    stall.push(S);
    people.push(P);
fork icon0
star icon3
watch icon1

+ 2 other calls in file

61
62
63
64
65
66
67
68
69
70
while(isNaN(opcao) || (opcao <= 0) || (opcao > 5) ){
    console.log('[Erro]... Opção invalida. Digite uma opcao de 1 a 5');
    opcaoUsuario = ''
    separador(msg='FICHA DE CADASTRO DE ALUNOS');
    menuDeOpcoes() ;      
    opcaoUsuario = readlineSync.questionInt("Digite a opcao:");        
    opcao = Number(opcaoUsuario);  
    separadorEnd(); 
}        
return opcao; 
fork icon0
star icon1
watch icon1

+ 4 other calls in file

146
147
148
149
150
151
152
153
154
155
        newNode.next = curr;
        this.length++;
    }
}
let list = new linked_list();
const value = readlineSync.questionInt('Enter a number: ');
let index = readlineSync.questionInt('Enter the index: ');
list.add(1);
list.add(2);
list.add(3);
fork icon0
star icon0
watch icon1

+ 9 other calls in file

316
317
318
319
320
321
322
323
324
325
    let bikes_info = [bikes,total_bikes]
    return bikes_info
}
else if (opt == 1){
    let bike_qty = store1.showbike()
    let user_choice = input.questionInt(`------ Enter the seriel number of that bike you want:------\n`)
    if(user_choice>bike_qty || user_choice<1){
        console.log("------ sorry, your request is Invalid:------");
        return 0
    }
fork icon0
star icon0
watch icon0

+ 45 other calls in file

16
17
18
19
20
21
22
23
24
25
if(back)console.log("\n[0]  < Back >")

let index = -1;
let breakLoop = false;
do{
  index = rls.questionInt(question+"   ") - (back?1:0) ;
  if(!options[index] && index !== -1) {
    console.log('Please enter a value between 0 - ' + ((options.length-1) + (back?1:0)));
  }else{
    breakLoop = true;
fork icon0
star icon0
watch icon1

+ 19 other calls in file

2
3
4
5
6
7
8
9
10
11
exports.__esModule = true;
var rls = require("readline-sync");
var mes = rls.question("ingrese el mes actual: ");
var mesDescuento = "octubre";
var precioUnitario = rls.questionFloat("precio del producto:$ ");
var cantidadProducto = rls.questionInt("cantidad del producto: ");
var subtotal = (cantidadProducto * precioUnitario);
var valorDescuento = (subtotal * 0.15);
var precioFinal = (subtotal - valorDescuento);
if (mes == mesDescuento) {
fork icon0
star icon0
watch icon0

7
8
9
10
11
12
13
14
15
16
17
18
19
  })


  return promise
}


const weight = readline.questionInt("What’s your weight? ")
const height = readline.questionFloat("What’s your height? ")


calculateBmi(88, 1.71)
  .then(result => console.log(`Sucesso: ${result}`))
fork icon0
star icon0
watch icon0

10
11
12
13
14
15
16
17
18
19
20
  return imc;
}


function main() {
  const kg = readline.questionFloat('Qual o seu peso? ');
  const cm = readline.questionInt('Qual a sua altura? ');
  const imc = bmi(kg, cm);
  if (imc < 18.5) {
    console.table(`${imc.toFixed(2)}: Abaixo do peso`);
  } else if (imc >= 18.5 && imc <= 24.9) {
fork icon0
star icon0
watch icon0

27
28
29
30
31
32
33
34
35
36
37
38


function createStudent(students) {
  console.log("Thêm sinh viên mới:");


  const name = readline.question("Ten: ");
  const age = readline.questionInt("Tuoi: ");
  console.log(
    "Chon gioi tinh [1: male, 2: female, 3: other] (Khong can bam Enter):"
  );
  const genderOptions = ["male", "female", "other"];
fork icon0
star icon0
watch icon0

+ 7 other calls in file

72
73
74
75
76
77
78
79
80
81
82
83
}


class Customer_Accounts{


    intro(){
        let opt = input.questionInt(`------Welcome to Accounts: \n\n-------1.Sign up\n-------2.Log in\n-------3.Exit\n`);
        if(opt == 3){
            console.log(`------ Exited----\n`);
            return 0
        }
fork icon0
star icon0
watch icon0

+ 35 other calls in file