index : temp_converter
Convert temperature degres
about summary refs log tree commit diff
author Justin Zelikoff <justinzelikoff@gmail.com> 2026-08-02 20:49:51 -0400
committer Justin Zelikoff <justinzelikoff@gmail.com> 2026-08-02 20:49:51 -0400
commit 10f65c4d531bdbaf32050a95144ce9ae42bdc9b9 [patch]
tree f67e76e75b56a2ffa1f803915215c67d125b5863
parent b534327b2fd94f4ddbc70b79222112b80d7c9481
download 10f65c4d531bdbaf32050a95144ce9ae42bdc9b9.tar.gz

refactor - cleaned up code

Diffstat

-rw-r--r-- src/main.rs 12
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/src/main.rs b/src/main.rs
index ff40e97..fdb0558 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,5 +1,4 @@
use std::io;
use std::process;

fn main() {
    println!("Welcome to the temperature converter!");
@@ -20,22 +19,17 @@

        if direction == "q" || direction == "Q" {
            break;
        } if direction != "1" && direction != "2" {
        } else if direction != "1" && direction != "2" {
            println!("Please make a valid selection!");
            continue;
        }

        let direction: u32 = direction.parse().expect("Please type a number!");

        let start_temp = read_temp();

        if direction == 1 {
        if direction == "1" {
            println!("{start_temp}F is equal to {}C",farenheit_to_celsius(start_temp));
        } else if direction == 2 {
            println!("{start_temp}C is equal to {}F", celsius_to_farenheit(start_temp));
        } else {
            println!("Please choose 1 or 2!");
            continue;
            println!("{start_temp}C is equal to {}F", celsius_to_farenheit(start_temp));
        }
    }
}