index : temp_converter
Convert temperature degres
about summary refs log tree commit diff
author Justin Zelikoff <justinzelikoff@gmail.com> 2026-08-02 20:39:57 -0400
committer Justin Zelikoff <justinzelikoff@gmail.com> 2026-08-02 20:39:57 -0400
commit b534327b2fd94f4ddbc70b79222112b80d7c9481 [patch]
tree 0ee70c4593c06f9561571338cc8fc39bf4d514b7
parent 060a723aae0142b8f6c6d952d5a4d1fccfe66549
download b534327b2fd94f4ddbc70b79222112b80d7c9481.tar.gz

refactor - flow structure, exit ability, and error handling

Diffstat

-rw-r--r-- src/main.rs 12
 1 file changed, 11 insertions(+), 1 deletion(-)

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

fn main() {
    println!("Welcome to the temperature converter!");
@@ -15,7 +16,16 @@
            .read_line(&mut direction)
            .expect("Failed to read line.");

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

        if direction == "q" || direction == "Q" {
            break;
        } 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();