go · level 1 check

a funfair token counter.

Time to build a real program! The funfair has a token booth. Your program asks how many rides someone wants, then asks for each ride by name. It looks up the ride, adds up the tokens and shows the total.

Each ride is a `Ride` struct with a `Name` and a number of `Tokens`, and they all live in a slice. The function `findRide` walks the slice and returns two values: the ride's tokens, and `true` if it was found. A `return` inside the loop stops the function straight away.

Be kind to your visitors: `DODGEMS` and `Dodgems` should both count. If a ride is not at the fair, say sorry and charge nothing. Fill in each `____`, run it, then try your own day out.

Fill in every ____ then run the checks.
  1. 1 It asks about every rideuses: loops
  2. 2 It adds up the tokensuses: running totals
  3. 3 It accepts any capitalsuses: text tricks
  4. 4 It says sorry for rides that are not at the fairuses: decisions
  5. 5 It cheers a big day outuses: functions
  6. 6 It copes with no rides at alluses: input

Take as long as you like and try as many times as you want.