Expected Double, but got Double

The error message of the day :wink:

image

And this is only some testcode.
And, of course, this does not make any sense, but I wanted to Do something like:
Double(0.12345).tostring(locale.current)
The message is world class :wink:

Doesn’t:

Var bla as Double = 0.123

suffice?

and, the “odd” message only occurs becuase of the unexpected “Double”.

What does:

Var bla as Double = Wiggy (0.123)

give?

Yes, of course, if I write it in two lines of code it does what it should do.
It’s a conversion that is not supported by Xojo. But it is supported by autocomplete and it’s a funny message.

Why do you need two lines of code? Doesn’t this already do what you want?

Dim a as double = if(bla, d, e)
a.tostring(locale.current)

How about

Var test As String = Format(3560.3, "\$###,##0.00") // $3,560.30

In the meantime, I seem to remember a feature request somewhere for adding extension methods to literals, but I can’t find it. But yeah, that is a pretty ambiguous message.

Yes, that is also possible, but I decided to use .toString(locale) in this project, and I don’t like to mix that.
Would just be much easier, to write something like string = Double(a - b).toString, than putting that in two lines.

Why don’t you use

Var test As String = CType(a - b, Double).ToString(Locale.Current)

or without the locale?

3 Likes