Skip to main content
Deno 2 is finally here 🎉️
Learn more

readline-Sync for Deno

implementation of readline for deno.land

Usage

deno run –allow-read –allow-write https://deno.land/x/readline_sync/tests/test_get.ts

import { readline } from 'https://deno.land/x/readline_sync/mod.ts'

let name: string = readline.puts('What\'s your name? ')

let age = Number(readline.puts('Your age: '))

readline.write(`Hello, ${name}, age: ${age}`)

deno run –allow-read –allow-write https://deno.land/x/readline_sync/tests/test_chooseOption.ts

import { readline } from 'https://deno.land/x/readline_sync/mod.ts'

let animals = ['Horse', 'Rooster', 'Cow', 'Dog', "Hamster"]
let select = readline.chooseOption(animals,"Which animal to choose? ")

readline.write(`You chose ${animals[select]}`)