Bug or inconsistency at Dim

This is the code:

Function Button1_onclick()
  Dim myCar = new Car("Ford", "Mustang", 1969)
  MsgBox(myCar.theYear)
End Sub
Function Button2_onclick()
  Dim myCar = new Car("Volkswagen", "Beetle", 1950)
  MsgBox(myCar.theYear)
End Function
Function Car(make, model, theYear)
  this.make = make
  this.model = model
  this.theYear = theYear
End Function

This code should work fine, but it doesn’t.
If I change line

Dim myCar = new Car(“Volkswagen”, “Beetle”, 1950)

to

Dim myCar
myCar = new Car(“Volkswagen”, “Beetle”, 1950)

then everything works even though this line is untouched:

Dim myCar = new Car(“Ford”, “Mustang”, 1969)

In other words: you can do it once in your code, but not twice. That’s strange!

Check the docs:

http://wiki.nsbasic.com/Dim

An optional initial value can also be supplied. This must be a simple variable, not an expression.

I have checked the wiki before writing this post. But I must have overseen the sentence ‘This must be a simple variable, not an expression.’ Sorry! (Btw: the wiki is so important and very good!)

But sometimes it works though to supply an expression in the dim row (like I said if I put it once it’s okay. But two times in one project doesn’t work). I would suggest to not allow expressions at all to avoid conflicts that occur sometimes and somtimes not. This inconsistency only frustrates coders.