From 95ad8ec059871c1b8e17aeee596aeaa28e96e9e3 Mon Sep 17 00:00:00 2001 From: Van Truong PHAN Date: Tue, 31 Oct 2023 13:12:32 +0100 Subject: [PATCH] Add sleep to observe the changes in the terminal when executing the code. Add sleep() to observe the changes in the terminal when executing the code When I copy and execute the code in the terminal, it runs too quickly, and I don't see anything appearing on the terminal. I struggle for a moment to understand the behavior of the 'output section.' --- console.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/console.rst b/console.rst index bb445b6b148..96bcc5dfcfb 100644 --- a/console.rst +++ b/console.rst @@ -346,19 +346,23 @@ method, which returns an instance of $section1->writeln('Hello'); $section2->writeln('World!'); + sleep(1); // Output displays "Hello\nWorld!\n" // overwrite() replaces all the existing section contents with the given content $section1->overwrite('Goodbye'); + sleep(1); // Output now displays "Goodbye\nWorld!\n" // clear() deletes all the section contents... $section2->clear(); + sleep(1); // Output now displays "Goodbye\n" // ...but you can also delete a given number of lines // (this example deletes the last two lines of the section) $section1->clear(2); + sleep(1); // Output is now completely empty! return Command::SUCCESS;