What does pass a flag object mean?

What does pass a flag object to pick up mean?

You need to tell pickupFlags() what flag to pickup.

flag = self.findFlags()

.findFlags() returns a flag object.

So, “flag” is a flag object.

Absolutely, but that is the explanation for retrieve a flag object. To pass a flag object is to send it to a function that may require it for its own processing. Assuming the code from @Vlevo, it would be passed like this:

in JavaScript

this.distanceTo(flag)

The important thing to recognize is that before it can be passed, you must retrieve it somehow. Often, this necessitates steps similar to @Vlevo’s code.

1 Like