87 — Screen: clearing, ruling and boxing
Output piles up and the screen gets messy. Four sentences tidy it.
Steps
Make
screen.nme:
run it →clear the screenEverything printed before it disappears. Korean is
화면 지워.Rule a line to separate one part from the next:
run it →draw a lineKorean is
줄 그어.A centred line looks like a title:
run it →say in the middle Today's menuKorean is
가운데 말해줘 오늘의 차림표.Put a box around anything that has to be noticed:
run it →say in a box Three minutes leftKorean is
상자로 말해줘 남은 시간은 3분입니다. A Korean letter takes two columns in a terminal, and the box counts that width so it never comes out crooked.Together they make one screen:
run it →clear the screen draw a line say in the middle Today's menu draw a line say in a box Coffee, tea, water
Try it
Combine it with a question, and redraw the screen after the answer:
clear the screen
say in the middle Tell me your name
draw a line
ask name Your name
clear the screen
say in a box Nice to meet you
say in the middle name
run it →What you learned
clear the screen/화면 지워empties the screen.draw a line/줄 그어rules one horizontal line.say in the middle …/가운데 말해줘 …centres a line.say in a box …/상자로 말해줘 …draws a box around it.- Both the box and the centring count Korean letters as two columns wide.