I was trying to get Boolean data with readLine()! but cannot input it
There was a compilation error saying
error: cannot convert value of type 'String' to specified type 'Bool'
I was trying to get Boolean data with readLine()! but cannot input it
There was a compilation error saying
error: cannot convert value of type 'String' to specified type 'Bool'
Copyright © 2021 Jogjafile Inc.
readLine()returns aString?. You cannot implicitly convert a String to Bool.Swift does not know what strings you consider to be a valid boolean value. Are
0and1considered boolean values by your app?noandyes?falschandwahr? Swift does not know. You need to parse it yourself, for example: