The GetCurrentLocation method of the location sensor returns several outputs, one of which is “error”. What type of value do I check for to determine whether there is an error? Null? Empty string? Something else? The documentation doesn’t mention this field. Thanks.
Any output can be safely connected directly to Label.Text and see its value. If “[Object object]” is displayed, then this is an object, if “null”, “undefined”, etc., it can be either a string or an object having a string representation. This value can be brought to the string type by connecting it through the text block “join” and compare it with the value of the string in the text block.
In our case, Location.error = “undefined” if there is no error.
The error
block will either be a non-empty string or will be undefined. The former is interpreted as true and the latter as false. Conseqeuently, the easiest thing is to just plug the error
block into the if
or test
block. Like so:
or
Happy thunking!
-Mark
2 Likes