Logo

Programming-Idioms

  • Rust
  • Pascal

Idiom #45 Pause execution for 5 seconds

Sleep for 5 seconds in current thread, before proceeding with the next instructions.

The pedestrian walks, then stays still for 5 seconds, then resumes walking
uses SysUtils;
sleep(5000);

Part of the Free Pascal Run-Time Library
use std::{thread, time};
thread::sleep(time::Duration::from_secs(5));
delay 5.0;

New implementation...
< >
programming-idioms.org