Something wrong with Readline. I can't use
readLine()!)!
My code is really simple:
var aYear = Int(readLine()!)!
func isLeap(year: Int) {
var leap = "NO"
//IF divisible by 4 with no remainders.
if year % 4 == 0 {
leap = "YES"
//Is leap year, unless:
}
if year % 100 == 0 {
leap = "NO"
//Is not leap year, unless:
}
if year % 400 == 0 {
leap = "YES"
//Is leap year.
}
print(leap)
}
//Don't change this
isLeap(year: aYear)
This error keeps coming up. I can't figure out how to fix this error:
"__lldb_expr_122/readline .playground:1: Fatal error: Unexpectedly found nil while unwrapping an Optional value
Playground execution failed:
error: Execution was interrupted, reason: EXC_BREAKPOINT (code=1, subcode=0x18f494588).
The process has been left at the point where it was interrupted, use "thread return -x" to return to the state before expression evaluation."
It is really strange because in online compiler this simple code works just fine.
PLEASE HELP ME. I CAN'T FIND THE SOLUTION. It's kinda internal xcode error or what...