Difference between revisions of "Code Snippet: Slow Printing"

From Coder Merlin
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Print characters to the terminal ''slowly'' ==
= Print characters to the terminal ''slowly'' =
 
== Swift ==
<syntaxhighlight lang="swift">
<syntaxhighlight lang="swift">
import Foundation
import Foundation
Line 11: Line 13:
print()
print()
</syntaxhighlight>
</syntaxhighlight>
== Python ==

Latest revision as of 09:06, 29 May 2019

Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder

Print characters to the terminal slowly[edit]

Swift[edit]

import Foundation

let string = "For the world is hollow, and I have touched the sky!"
for character in string {
    print(character, terminator:"")
    fflush(stdout)
    usleep(50000)
}
print()

Python[edit]