02 — Story: writing many lines without repeating yourself
In guide 01 every line began with say. That is fine for a line or two, but a
story means writing the same word again and again. A story: block puts every
line inside it on the screen exactly as you wrote it.
Steps
Type this into the writing box:
run it →story: The door opened slowly. The room was empty. One letter lay on the table. endstory:opens the block andendcloses it. Indent the lines inside by four spaces. Korean is이야기:…끝:
run it →이야기: 문이 천천히 열렸습니다. 방 안은 비어 있었습니다. 탁자 위에 편지가 한 장 놓여 있었습니다. 끝A blank line inside the block is a blank line on the screen, so paragraphs need nothing special:
run it →story: It was the first day. Then the second day came. endTo have the letters arrive one at a time, put
slowin front. It is what guide 03 does to a single line, done to a whole block:
run it →slow story: The wind knocked at the window. Nobody answered. endSet the speed yourself by naming it:
run it →slow story every 0.15 seconds: One. Two. Three. endKorean is
천천히 이야기:,아주 천천히 이야기:,0.15초씩 천천히 이야기:.Everything inside the block is text. Nothing in it is a command. If you write
wait 3 secondsinside a story, the words wait 3 seconds appear — the program does not wait. For a story that is the right answer, because a character may well say it. To really wait, close the block withendand write it outside:
run it →story: The night was late. end wait 1 second story: Then someone knocked. end
Try it
Write a five-line story. Let the first three lines appear at normal speed and the last two arrive letter by letter.
story:
It was a very old library.
The books stood at every thickness.
On the bottom shelf one lay flat.
end
slow story:
That book had no title.
Its first line read like this.
end
run it →What you learned
story:…endputs every line inside it on the screen as written.slow story:sends the letters out one at a time.slow story every 0.15 seconds:sets the speed yourself.- Korean is
이야기:·천천히 이야기:·0.15초씩 천천히 이야기:. - Nothing inside the block is a command. It is all text.