Improving our example 1-variables 217 Note Remember that we need delayserver running in a terminal window so that we get a response to our HTTP GET requests. See the Technical requirements section for more information. Now that we've got the boilerplate out of the way, it's time to start making the improvements we talked about. Improving our base example We want to see how we can improve our state machine so that it allows us to hold variables across wait points. To do that, we need to store them somewhere and restore the variables that are needed when we enter each state in our state machine. Tip Pretend that these rewrites are done by corofy (or the compiler). Even though corofy can't do these rewrites, it's possible to automate this process as well. Or coroutine/wait program looks like this: coroutine fn async_main() { println!("Program starting"); let txt = Http::get("/600/Hello Async Await"). wait; println!("{txt}"); let txt = Http::get("/400/Hello Async Await"). wait; println!("{txt}"); } We want to change it so that it looks like this: coroutine fn async_main() { let mut counter = 0; println!("Program starting"); let txt = http::Http::get("/600/Hello Async Await"). wait; println!("{txt}"); counter += 1; let txt = http::Http::get("/400/Hello Async Await"). wait; println!("{txt}"); counter += 1; println!("Received {} responses. ", counter); }