The is and !is Operators
Learn how to effectively use the is and !is operators for type checks.
We'll cover the following
Using the is
operator
Since we have already mentioned the is
operator, let’s discuss it in a bit more depth. It checks if a value is of a certain type. We know already that 123
is of type Int
, and "ABC"
is of type String
. Certainly, 123
is not of type String
, and "ABC"
is not of type Int
. We can confirm this using the is
check.
Get hands-on with 1200+ tech skills courses.