Whats wrong with my code?

I´m creating a program that converts celcius to farenheit. Getting some error and not sure why.

use std::io;

fn main() {
    let mut celcius = 0.0;
	let mut farenheit = 0.0;
	println!("Write 1 for celcius or 0 for farenheit");
	let mut input_string = String::new();
	
	io::stdin()
	.read_line(&mut input_string)
	.expect("Failed to read line");
		
	let input_string: u32 = match input_string.trim().parse() {
		Ok(num) => num,
		Err(_) => continue,
	};
	
	
	If input_string == 1
	{
			println!("Converting from celcius to farenheit");
	} else {
			println!("Converting from farenheit to celcius");
	}
	
}

error: expected one of !, ., ::, ;, ?, {, }, or an operator, found input_string
--> src\main.rs:19:5
|
19 | If input_string == 0
| ^^^^^^^^^^^^ expected one of 8 possible tokens
error[E0268]: continue outside of a loop
--> src\main.rs:15:13
|
15 | Err(_) => continue,
| ^^^^^^^^ cannot continue outside of a loop
error: aborting due to 2 previous errors

If should be lower case.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.