我是一个新手学习编程,我正在使用的书是使用Liberty Basic。 本书给出了下面的代码示例,用于二维数组。
dim victim$(2, 3)
for i = 1 to 2
for j = 1 to 3
prompt "Who do you want to hurt?"; enemy$
victim$(i, j) = enemy$
next j
next i
prompt "Type x location of the array item that you want to print, such as 1:"; x
prompt "Type y location ot the array item that you want to print, such as 1:"; y
print victim$(x, y) + " deserves to be hurt the most."
end
但是当我使用Liberty Basic v4.04运行此示例时,我在这行代码中收到语法错误:
dim victim$(2, 3)
非常感谢任何帮助。
答案 0 :(得分:0)
我明白了。
答案:
dim victim$(2, 3)
for i = 1 to 2
for j = 1 to 3
prompt "Who do you want to hurt?"; enemy$
victim$(i, j) = enemy$
next j
next i
prompt "Type x location of the array item that you want to print, such as 1:"; x
prompt "Type y location ot the array item that you want to print, such as 1:"; y
print victim$(x, y) + " deserves to be hurt the most."
end
一旦我删除了额外的空行,代码就可以了。