What you will learn
Produce values lazily and understand a recursive base case.
Common mistake
Every recursive path must move toward a reachable base case.
Produce values lazily and understand a recursive base case.
Every recursive path must move toward a reachable base case.
Experiment with the program below. Your code and input are sent to the selected compiler only when you run it.
Tab indents · Shift+Tab unindents · Esc then Tab leaves the editor · Ctrl/Cmd+Enter runs · Ctrl/Cmd+S saves a draft
Changes save automatically to your account.
No input required.Expected output for the original program
[4, 3, 2, 1]
Output will appear here.
Educational simulation — object identities and execution steps are illustrative.