as? vs is

Here’s the code if you want to experiment with it!

let mystery: Any = Bool.random() ? 1 : "One"

if mystery is Int {
    print("It's an Int!")
}
Previous
Previous

opaque argument

Next
Next

for-loop vs filter()