3 ms·
Sure, but I don't think anyone's complaining about how you would assign race completion position labels in a programming language. Surely you would do something
by baddox 7y ago
Sure, but I don't think anyone's complaining about how you would assign race completion position labels in a programming language. Surely you would do something like this:
// Start the position at one, because that's how we
// assign number labels to finishers in a race.
let position = 1
// Create a callback that will assign a label to
// each competitor when that competitor finishes
// the race.
let assignLabel = (competitor) => {
competitor.label = position
position = position + 1
}
// Begin the race, and pass it a callback that will
// be run each time a competitor finishes the race
// (in the order they finish).
race.begin(assignLabel)
Note that this "label" really is just a label. It happens to be an integer here, but we could also use a library that outputs English strings like "first", "second", "third", etc. This debate is focused more on how elements in an ordered collection are accessed.