I am trying to compare variables using the expression “P1 == P2” but GP Script is yielding an error and is telling me it is expecting a “double expression”. I am confused because both P1 and P2 are doubles?
The variables are not floats. They are parameters that represent (in this case) doubles, per your declaration.
P1 : Parameter = ....
I did some (perhaps too) cute automatic reinterpretation when parameters are used in conjunction with doubles (or integers or strings in the case of parameters that represent integers or strings respectively) to avoid the need to use functions to get and set their values.
That said, the issue you found is interesting but requires some thinking
In particular, when you write something like
if P1 == P2 ...
the question is whether that should be testing to see if P1 and P2 are the same parameter (which obviously they’re not in this case) but consider what should happen if you pass a parameter to a function and you want to know what parameter you’ve got.
I will put this in our tracking system for further investigation
Interesting thought My thoughts: P1 and P2 are objects and therefore you should be testing their property values in some respect. Considering my line of thinking for a moment: Couldn’t P1/P2 have properties? … for example - a name, a value, etc.? EG: P1.Value