0
0
PowerShellscripting~15 mins

Integer and floating-point types in PowerShell - Mini Project: Build & Apply

Choose your learning style9 modes available
Integer and Floating-Point Types in PowerShell
📖 Scenario: You are working with numbers in a PowerShell script. Some numbers are whole numbers, and some have decimals. You want to understand how to create and use both integer and floating-point numbers.
🎯 Goal: Learn how to create integer and floating-point variables in PowerShell, and display their values and types.
📋 What You'll Learn
Create an integer variable with a specific value
Create a floating-point variable with a specific value
Display both variables and their types
💡 Why This Matters
🌍 Real World
Scripts often need to work with different kinds of numbers, like counts or measurements with decimals.
💼 Career
Understanding number types helps in writing scripts that handle data correctly in automation tasks.
Progress0 / 4 steps
1
Create an integer variable
Create a variable called wholeNumber and set it to the integer value 42.
PowerShell
Need a hint?

Use = to assign the value 42 to the variable $wholeNumber.

2
Create a floating-point variable
Create a variable called decimalNumber and set it to the floating-point value 3.14.
PowerShell
Need a hint?

Use = to assign the value 3.14 to the variable $decimalNumber.

3
Display the variables and their types
Use Write-Output to display the value of $wholeNumber and its type using GetType().Name. Then do the same for $decimalNumber.
PowerShell
Need a hint?

Use Write-Output with double quotes and $() to show the value and type.

4
Run the script to see the output
Run the script to display the values and types of $wholeNumber and $decimalNumber.
PowerShell
Need a hint?

Run the script in PowerShell. You should see the values and their types printed.