字符串不能转换为布尔值
这是while循环的条件
boolean yes = "true", no = "false";我希望输出应该是,如果用户输入"yes“,while循环将重复,如果"no”,循环将中断
发布于 2019-10-05 04:29:47
您可以创建一个接受字符串并返回布尔值的方法。
func isBoolean(String: yourString) -> boolean {
if yourString == "yes"
return true
else
return false
}https://stackoverflow.com/questions/58240416
复制相似问题