...

/

Checking and Casting Data Types

Checking and Casting Data Types

Learn how to check the type of data and how to cast it into different data types.

We'll cover the following...

Checking the Data Type

Every Powershell object automatically has an in-built method, GetType(), which can be accessed using the (.) dot operator, as demonstrated in the following example to check data types.

Press + to interact
## to check the data type in powershell
## provides an inbuilt method GetType()
'this is a string'.GetType()
(1298).GetType()
([char]'s').GetType()
(0.0099999).GetType()

Similarly, in Python, we can use the type() ...