Xojo 类型不匹配错误。预期的字符串,但得到布尔值
Xojo Type mismatch error. Expected String, but got Boolean
(我今天开始学习数组。)编辑:我意识到 = 显然是导致错误的原因,因为它被视为“比较是否相等”与“赋值”。
我没有看到引用行中的哪一部分导致了错误:
'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
(我今天开始学习数组。)编辑:我意识到 = 显然是导致错误的原因,因为它被视为“比较是否相等”与“赋值”。
我没有看到引用行中的哪一部分导致了错误:
'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