D
Deno

help

What is the std library for making a guessing game like shown in rust?

A.auteur8/21/2023
use std::io;

fn main() {
println!("Guess the number!");

println!("Please input your guess.");

let mut guess = String::new();

io::stdin()
.read_line(&mut guess)
.expect("Failed to read line");

println!("You guessed: {guess}");
}
use std::io;

fn main() {
println!("Guess the number!");

println!("Please input your guess.");

let mut guess = String::new();

io::stdin()
.read_line(&mut guess)
.expect("Failed to read line");

println!("You guessed: {guess}");
}
IioB8/21/2023
The Deno equivalent could be:
console.log("Guess the number!");
const guess = prompt("Please input your guess.\n");
console.log(`You guessed: ${guess}`);
console.log("Guess the number!");
const guess = prompt("Please input your guess.\n");
console.log(`You guessed: ${guess}`);

Looking for more? Join the community!