Xojo类型不匹配错误预期为字符串,但为布尔值

问题描述

(我今天开始学习数组。)编辑:我意识到=正引起错误,因为它被视为“相等时比较”与“分配此值”。

我看不到引用行中的哪个部分导致了错误

'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

解决方法

我发现了错误。它是de.Value和citylistDE之间的=。 我将其从=更改为+。

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