needmoreeasy EN 한국어
Learn

87 — Screen: clearing, ruling and boxing

★★☆☆☆ (2/5)arranging the screen
Prerequisites
86 — Story
You will end up with
a program that clears the screen, centres a title and draws a box

Output piles up and the screen gets messy. Four sentences tidy it.

Steps

  1. Make screen.nme:

    clear the screen
    
    run it →

    Everything printed before it disappears. Korean is 화면 지워.

  2. Rule a line to separate one part from the next:

    draw a line
    
    run it →

    Korean is 줄 그어.

  3. A centred line looks like a title:

    say in the middle Today's menu
    
    run it →

    Korean is 가운데 말해줘 오늘의 차림표.

  4. Put a box around anything that has to be noticed:

    say in a box Three minutes left
    
    run it →

    Korean is 상자로 말해줘 남은 시간은 3분입니다. A Korean letter takes two columns in a terminal, and the box counts that width so it never comes out crooked.

  5. Together they make one screen:

    clear the screen
    draw a line
    say in the middle Today's menu
    draw a line
    say in a box Coffee, tea, water
    
    run it →

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.

This page on GitHub