Closures and captured variables

F-CLOSURE-V4-2medium

Keep the quoted price

A front desk counts each visitor’s visits, quotes prices that can change later and schedules reminders.

What needs to change

Repair makeQuote so a quote keeps the price from when it was made.

Reproduce

  1. Use go run on the sample price list and compare the first shown quote with the expected stdout.

Acceptance criteria

Your review marks · Saved in this browser. Test acceptance is tracked separately.

Notes

The file contains its imports, readRows, makeQuote and main. main keeps every quote func and calls them on show.

Input: price item amount, quote item or show on each line.

Every quoted item already has a price; commands are valid, and amounts are small nonnegative whole numbers within the shown types. Reader validation is outside this task.

Sign in to open this exercise

The ticket brief is public. Sign in to access the exercise. Paid exercises require Pro.

Sign in