Terminal control/Preserve screen: Difference between revisions
Added Kotlin
m (added whitespace before the TOC (table of contents), added a ;Task: (bold) header.) |
(Added Kotlin) |
||
Line 117:
This task does not admit sample output, but you can demonstrate this solution for yourself using the chrome browser: control-shift-J then copy and paste the above into the command line, and hit enter.
=={{header|Kotlin}}==
{{trans|C}}
{{Works with|Ubuntu|14.04}}
<lang scala>// version 1.1.1
const val ESC = "\u001B"
fun main(args: Array<String>) {
print("$ESC[?1049h$ESC[H")
println("Alternate screen buffer")
for(i in 5 downTo 1) {
print("\rGoing back in $i second${if (i != 1) "s" else ""}...")
Thread.sleep(1000)
}
print("$ESC[?1049l")
}</lang>
=={{header|Mathematica}}==
|