performingReverseGeocoding

Page 675: MyLocations
Hi, I’m wondering why performingReverseGeocoding is true when entering this condition “if !performingReverseGeocoding {” because it was never set to true in the code earlier
Thanks

I can’t find the relevant code you mention on page 675. Are you by any chance using the ePub version of the book? If yes, then the page numbers would be different :slight_smile: The PDF version would give you the right version numbers. If not, mentioning the chapter would be helpful since otherwise, I can’t be certain that I’m talking of the same code as you …

On the PDF version, I think the page you’re talking about might be page 531. If that is correct, then the reason for the code is as follows:

We initialize performingReverseGeocoding to false at the beginning. So, when you first come to this bit of code, performingReverseGeocoding is false and so, since we say !performingReverseGeocoding in the if condition, we are actually checking for performingReverseGeocoding not being true and so the condition passes. (Note the ! before the variable name, that’s a NOT operator which flips the value of the boolean variable …)

Does that make sense?

We then set performingReverseGeocoding to true inside the if condition so that another reverse geocoding operation will not be performed while we are in the middle of the first operation.

okay I understand now thank you so much for your help :slight_smile:

This topic was automatically closed after 166 days. New replies are no longer allowed.