Go zero values and short declarations

F-ZERO-V4-2medium

Stop on a bad quantity

The tool-shed register must distinguish unavailable stock from unknown tools, reject a bad import before printing stock, and count rentals without a setup call.

What needs to change

Repair parse so the first bad quantity stops the import and main prints its line number without a partial stock list.

Reproduce

  1. Run go run on the sample list and compare its output with the expected single line.

Acceptance criteria

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

Notes

The file contains its imports, readLines and the complete main, which prints the returned message or the sorted stock.

Input: one "tool quantity" pair per line. Valid quantities fit a Go int.

Sign in to open this exercise

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

Sign in