latitude()

Returns the latitude of the agent’s site for a given place, or the latitude of the agent itself.

Synopsis

latitude()
latitude(place_name)

Description

This function returns the latitude of the agent itself if no argument is given. Otherwise it returns the latitude of the agent’s site for the given place name. For example, latitude(Workplace) returns the latitude of the agent’s specific Workplace site.

If no parameter was provided, this function returns the latitude of the agent itself if no argument is given. Note that the coordinates of the agent are not updated unless the agent has been moved with the move() action.

Parameters

place_name

The name of a place that the agent can visit.

Returns

With no argument, this returns the latitude of the agent itself as a floating point number.

If place_name is given, then the latitude of the agent’s site for this place is returned.

Examples

This statement returns the latitude of the agent’s school

latitude(School)

The following transition statement sends the agent to a StartWinter state if their latitude is greater than \(39\).

if (latitude() > 39) then next(StartWinter)

Errors

It is an error if the agent is not a member of the given place.

See Also

elevation(), longitude(), move()