It's just an equality expression compared to the value of a ternary expression. Basically:
- If
trip_count
is truthy, then return ride_cost_remaining
.
- If
trip_count
is falsy, then return 0
.
- Compare
trip_position
to the return value of the ternary expression, and return a Boolean value based on whether they are equal.
What these values actually are and why the code was written this way can't be determined from your posted code, and I'm not sure that it makes sense to add a Boolean like true
or false
to this_trip_cost
before assigning it to t.apportioned_fare
.
Maybe your code works, and maybe it doesn't. Still, that's what the expressions are actually doing, but only you know what the values of each subexpression actually are.