Kotlin“预期变量”给数组元素赋值时出错
我正在编写以下嵌套函数,其中 dfsVisit 使用外部函数中声明的数组“numCaminos”和“colores”
但是,kotlin 编译器在第 31 行和第 34 行的赋值上给出了“预期变量”错误,此错误不会出现在嵌套 dfsVisit 函数内的任何其他数组赋值上。我尝试解除函数的嵌套并将数组作为 dfsVisit 的参数传递,但问题在这两个分配上仍然存在。为什么会发生这种情况?
我通过存储库包在 Manjaro Linux 中运行 Kotlin 编译器
注意:很抱歉使用图片而不是代码块,帖子编辑器给了我一些格式问题。
I'm writing the following nested function where dfsVisit uses the arrays "numCaminos" and "colores" declared in the outer function
However the kotlin compiler is giving me a "variable expected" error on the assignments in lines 31 and 34 specifically, this error doesn't show up on any of the other Array assignments within the nested dfsVisit function. I tried de-nesting the functions and passing the arrays as arguments of dfsVisit but the problem persisted on those 2 assignments specifically. Why could this be happening?
I'm running the Kotlin compiler in Manjaro Linux through the repository package
Note: Sorry for using a picture instead of a code block, the post editor was giving me some formatting issues.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需从作业的左侧删除
!!
即可。那里确实没有意义。Just remove
!!
from the left side of the assignment. It doesn't really make sense there.