• Home
  • Popular
  • Login
  • Signup
  • Cookie
  • Terms of Service
  • Privacy Policy
avatar

Posted by John Dev


12 Jan, 2025

Updated at 20 Jan, 2025

CTRL-C doesn't work to end endless loop from book

Hi Friends.

I'm learning Rust from the online Rust book to write a compiler. Anyways I can't seem to get CTRL-C to work correctly to end the program and close the loop, as per the instructions in the book.

The relevant chapter: Control Flow - The Rust Programming Language

The Relevant code:

fn main() {
    loop {
        println!("again!");
    }
}

I'm running cargo run it compiles, and runs, and just loops.

I'm running on an M2 MAX Macintosh.

Anyways I'd love to know what I can do to make this work properly. I'll even submit a PR to the book to change the chapter to reflect how to use CTRL-C.

Thanks new friends!

-kow

3 posts - 3 participants

Read full topic