"List.AllIndicesOf" or "List.IndexOf" works for System.Int64 but not System.Double - is this right?

Is this as intended?


All_Indicies_Error.dyn (28.8 KB)
Screenshot 2024-06-12 085212

Hi @SteveDFT I guess your 5 in the codeclock is interger…try with 5.0

1 Like

Hi @sovitek,

I guess my question is. Why aren’t System.Double supported? Shouldn’t they be? Is this a bug?

no it has to be the same object type for compare

3 Likes

To expand on @sovitek’s answer, AllIndicesOf and IndexOf are object comparisons and not value comparisons. The object is different because integers and doubles are different object types. Even though their values are still the same.

If you’re going to be dealing with numbers a lot and need to make a variety of comparisons, it’s best to force everything into a double.

2 Likes

I was very much not even considering the item type at the other end. I think I was stuck on seeing somewhere that only numbers were supported and I was thinking, these are all numbers but just different types of numbers.

Thanks to all for this clarification

1 Like