I am not a kotlin expert, but ...
crewCrewCrew.forEach {
mammalFactCheck(it, Mammal::vertebraeCount)
mammalFactCheck(it, Mammal::knownSpeciesCount)
}
... appears to be a loop which iterates over the entries in the
crewCrewCrew
list (created above). For each entry it then calls
mammalFactCheck
, passing
it
(the mammal object from the forEach statement), and a check value. The
mammalFactCheck
function uses the mammal object and the two function pointers
vertebraeCount
and
knownSpeciesCount
, to get the relevant values for the type of mammal. But it does not do anything with those returned values.
If you run this code in your debugger and step through you will be able to see the sequence of operations.