any choice = io:readln("Enter choice 1 - 5: ");
我似乎无法将输入转换为 int。
检查和匹配都给出相同的错误
var intChoice = <int>choice;
match intChoice {
int value => c = value;
error err => io:println("error: " + err.message);
}
和
c = check <int>choice;
给
error: 'string' cannot be cast to 'int'
我查看了https://ballerina.io/learn/by-example/type-conversion.html并研究了https://ballerina.io/learn/api-docs/ballerina/io.html#readln但没有运气。
我究竟做错了什么?