Lesson 2 +10 XP

The REPL & Code Fields

The REPL & Code Fields

Strudel lives in an interactive editor called the REPL (read-evaluate-play-loop). In this course, every code block is a miniature REPL.

How to use a code field

  1. Click into the text field.
  2. Press Ctrl+Enter (Windows/Linux) or Cmd+Enter (Mac) to play.
  3. Edit the code while it plays - the music updates live.
  4. Press Ctrl+. to stop.

Try it now

  1. Click into the box above.
  2. Press Ctrl+Enter to play.
  3. Change casio to metal.
  4. Press Ctrl+Enter again - the sound changes instantly.

Change one thing at a time

Live coding works best when you make small changes. Play a sound, then change just one word, then play again. Compare how the sound changes.

The code field is a mini-editor

  • You can type and delete text freely.
  • The code loops automatically once playing.
  • Ctrl+. stops everything.
  • You can also Ctrl+Z to undo while experimenting.

TL;DR

  • Press Ctrl+Enter to play, Ctrl+. to stop.
  • Click into a field first to focus it.
  • Edit while it plays - updates are live.
  • Make small changes and listen carefully.