Bad arguments to +:The operation + cannot accept the arguments

« 返回社区索引

Bad arguments to +:The operation + cannot accept the arguments

报错信息

Bad arguments to +
The operation + cannot accept the arguments:, [""], [81]

原因

原因是加号 + 前面是空字符串,不能有效地转换成数字,所以报错。

比如 "123" 这个字符串可以自动转数字,但是空文本不行。

解决方法

文本要判断空,然后给数字 0

同理,空文本不但不能转数字,也不能转列表、字典等数据类型,否则都会发生异常,弹窗报错!


来源:Bad arguments to +:The operation + cannot accept the arguments

本文由 App Inventor 2 中文网 整理

文档反馈