use std::io;
use std::io::Write; // need it to flush stdout

static PROMPT: &'static str = "$ ";

fn execute(cmd: &String) {
    println!("you entered [{}]", cmd);
}

fn main() {

    // we allocate a String for the user input
    let mut input: String = String::new();

    loop {

        print!("{}", PROMPT);
        if let Err(why) = io::stdout().flush() {
            println!("error: {}", why);
            continue;
        }

        // input probably has stuff in it from the last command, so clear
        // it out
        input.clear();

        // read input into our String. if there was an error, print the
        // error message and continue
        if let Err(why) = io::stdin().read_line(&mut input){
            println!("error: {}", why);
            continue;
        }

        // trim the newline off and save it back
        input = input.trim().to_string();

        execute(&input);

        if input == "exit" {
            println!("Exiting!");
            break;
        }
    }

}


use std::io::Write; // need it to flush stdout

static PROMPT: &'static str = "> ";

fn main() {

    // we allocate a String for the user input
    let mut input: String = String::new();

    loop {

        print!("{}", PROMPT);
        // the print! macro line buffers and doesn't automatically flush
        std::io::stdout().flush();

        input.clear();

        // read input into our String
        std::io::stdin().read_line(&mut input);

        // trim the newline off and save it back
        input = input.trim().to_string();

        println!("you entered [{}]", input);

        if input == "exit" {
            println!("Exiting!");
            break;
        }
    }

}


--- 
+++ 
@@ -1,11 +1,6 @@
-use std::io;
 use std::io::Write; // need it to flush stdout
 
-static PROMPT: &'static str = "$ ";
-
-fn execute(cmd: &String) {
-    println!("you entered [{}]", cmd);
-}
+static PROMPT: &'static str = "> ";
 
 fn main() {
 
@@ -15,26 +10,18 @@
     loop {
 
         print!("{}", PROMPT);
-        if let Err(why) = io::stdout().flush() {
-            println!("error: {}", why);
-            continue;
-        }
+        // the print! macro line buffers and doesn't automatically flush
+        std::io::stdout().flush();
 
-        // input probably has stuff in it from the last command, so clear
-        // it out
         input.clear();
 
-        // read input into our String. if there was an error, print the
-        // error message and continue
-        if let Err(why) = io::stdin().read_line(&mut input){
-            println!("error: {}", why);
-            continue;
-        }
+        // read input into our String
+        std::io::stdin().read_line(&mut input);
 
         // trim the newline off and save it back
         input = input.trim().to_string();
 
-        execute(&input);
+        println!("you entered [{}]", input);
 
         if input == "exit" {
             println!("Exiting!");
Add error checks, change prompt, add execute fn
