I have a problem getting this if else block to work as I wanted to. I have received the data from an API and while when I printed it it says "nil", however, the program still crashed
print(i["dogs"]!!["breed"])
if (i["dogs"]!!["breed"]) == nil {
item5.append(00000)
} else {
item5.append((i["dogs"]!!["breed"] as! Int))
}
the print prints out nil however, it seems that the if else block didn't work as I intended
thanks for the help !
EDIT: maybe I should've explained more clearly on my question... I am having some trouble understanding the part of the if-else statement that supposedly should run the block if the condition is met ((i["dogs"]!!["breed"]) == nil in this case). So why didn't my block run ?