Skip to content
Lesson 1 of 9 Free Preview
Duration: 20 min

Lists in Scratch

Learn it

A list stores many items in order. Make one in Variables โ†’ Make a List. Blocks: add [ ] to [list], item (1) of [list], length of [list], delete all of [list]. Scratch lists start at item 1.

๐Ÿงฐ Tool: free Scratch online editor (no account needed to try; a parent can create one to save projects) or the free ScratchJr app for tablets.

Code examples

Blocks (Scratch)

when green flag clicked
delete all of [jokes]
add [Why did the cookie go to the doctor? It felt crummy.] to [jokes]
add [What do you call a sleeping dinosaur? A dino-snore.] to [jokes]
add [Why are fish so smart? They live in schools.] to [jokes]

when this sprite clicked
say (item (pick random (1) to (length of [jokes])) of [jokes]) for (4) seconds

Project: Joke bot

  1. Make a jokes list.
  2. Add 5 jokes.
  3. Click to hear a random one.

Challenge: Ask the user for a new joke and add it with ask and wait.

Enjoying this lesson?

Enroll in the full course to access all lessons, track your progress, and earn a certificate.

Enroll in Full Course