Using Switch Statement in PowerShell
📖 Scenario: You are creating a simple script to categorize fruits based on their color. This will help a fruit seller quickly identify the type of fruit by its color.
🎯 Goal: Build a PowerShell script that uses a switch statement to print the fruit category based on the fruit color.
📋 What You'll Learn
Create a variable with a fruit color
Create a variable with a fruit name
Use a
switch statement to check the fruit colorPrint the fruit category based on the color
Handle at least three colors: red, yellow, green
💡 Why This Matters
🌍 Real World
Switch statements help automate decisions based on different input values, like categorizing items quickly.
💼 Career
Knowing switch statements is useful for scripting tasks in IT, system administration, and automation roles.
Progress0 / 4 steps