type-mismatchxojo

Xojo Type mismatch error. Expected String, but got Boolean


(I started learning about arrays today.) Edit: I realized the = is apperently causing the error because it's seen as a "compare if equal" vs "assign this".

i don't see which part in the referenced line is causing the error:

'Option 1
Var citylistDE(5) as string

citylistDE(0) ="Genf"
citylistDE(1)="Lausanne"
citylistDE(2)="Bern"
citylistDE(3)="Basel"
citylistDE(4)="Zürich"
citylistDE(5)="St.Gallen"


dim countDe as Integer = citylistDE.LastRowIndex
for i as integer = 0 to countDe
  de.Value = de.Value = citylistDE(i) + EndOfLine '<===  THIS LINE ?
next

'Option2
var citylistFR() as string =  array("Genève", "Lausanne", "Berne", "Bale", "Zurich", "Sant-Gall")

dim countFR as integer = citylistFR.LastRowIndex
for i as integer = 0 to countFR
  fr.Value = fr.Value + citylistFR(i) + EndOFLine
next

Solution

  • i found the error. It was the = between de.Value and citylistDE. I changed it from = to +.

    de.Value = de.Value = citylistDE(i) + EndOfLine
    next
    to
    de.Value = de.Value + citylistDE(i) + EndOfLine
    next