0

I recently started learning rust as my first language other than python. I wanted to create a simple program that will calculate few things and I will be able to choose what code is going to be executed by typing the correct command in console.

use std::io;

fn main() {
    println!("Możliwe opcje: (1) miejsca_zeorwe, (2) prosta , (3) równanie_funkcji");
    let mut input = String::new();
    io::stdin().read_line(&mut input).expect("Błędna komenda");

    if input == "1" {
        println!("Twój wybór - miejsca_zeorwe");
    } else if input == "2" {
        println!("Twój wybór - równanie prostej");
    } else if input == "3" {
        println!("Twój wybór - punkt przecięcia");
    }
}

That's how I wanted to do this. Unfortunately, after inputting one of the numbers, if statement isn't doing what it is supposed to do. There isn't any output. I couldn't find any guide or documentation that would address something like that. Is there some special way to write if in situation like that, or it is wrong since the start?

Konbor
  • 1

0 Answers0