needmoreeasy EN 한국어
Learn

86 — Story: letters arriving one at a time

★★☆☆☆ (2/5)stories and slow output
Prerequisites
05 — Repeat
You will end up with
a program whose text appears one letter at a time, the way a novel unfolds

show puts a whole line on screen at once. When you are telling a story, letters arriving one at a time read better. say slowly does that.

Steps

  1. Make story.nme:

    say slowly The door opened slowly.
    
    run it →

    The letters arrive one by one. Korean is the same:

    천천히 말해줘 문이 천천히 열렸습니다.
    
    run it →
  2. For something slower still, add very:

    say very slowly Nobody was there.
    
    run it →

    Korean is 아주 천천히 말해줘 아무도 없었습니다.

  3. You can set the speed yourself:

    say slowly every 0.2 seconds One. Two. Three.
    
    run it →

    Korean is 0.2초씩 천천히 말해줘 하나. 둘. 셋.

  4. A story is usually several lines. wait between them lets it breathe:

    say slowly The night was late.
    wait 1 second
    say slowly Then someone knocked.
    
    run it →
  5. Mix in a question and a condition, and the reader chooses the story:

    say slowly Do you open the door?
    ask answer yes or no
    if answer equals yes
        say slowly Outside, snow was falling.
    else
        say slowly The footsteps faded away.
    end
    
    run it →

Try it

Write a three-line story: the first line at normal speed, the middle line slowly, the last line very slowly.

show It was a winter night
say slowly Something moved outside the window.
say very slowly It had waited a very long time.
run it →

What you learned

  • say slowly … sends the letters out one at a time.
  • say very slowly … does the same, slower.
  • say slowly every 0.2 seconds … sets the speed yourself.
  • Korean is 천천히 말해줘, 아주 천천히 말해줘, 0.2초씩 천천히 말해줘.
  • wait 1 second between lines lets a story breathe.

This page on GitHub