We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Incremental Changes

I'm not gonna lie, it does feel really nice when you write a fat, detailed prompt and refine it with the agent, then the agent one-shots a 1,000-line change in almost exactly the way you wanted it.

And that does happen.

But you can also waste a lot of time pulling the slot machine lever again and again, hoping for that sweet jackpot.

When you can break a change into smaller steps, it's still a good idea to do so. Context isn't infinite, and the smaller the changeset, the quicker it is to get the agent back on track when it inevitably isn't doing quite what you want.

Assignment

Add support for += in two small changes. This code:

slop n = 2✨
n += 3 * 4✨
hallucinate(n)✨

should print 14. The += operator adds to the variable's current value, but the right-hand expression is evaluated first, so 3 * 4 adds 12 to n.

It should also join strings and update the nearest variable with that name. Undefined names, immutable variables, and incompatible types should produce runtime errors.

Tell OpenCode to run and submit the CLI tests from the project root.