Question
PowerShell # Leave all comments and instructions. # Put your PowerShell code below the problem description # in an uncommented line. # Run the following
PowerShell
# Leave all comments and instructions.
# Put your PowerShell code below the problem description
# in an uncommented line.
# Run the following code to set variables
$a = 5
$b = "Hello World"
$c = @("Alice", "Bob", "Charlie")
# Sample: Write a comparision to determine if 5 equals 6
# (The solution goes on the following line)
5 -eq 6
# For the following problems, use Write-Host to output text
# For example:
Write-Host "Hello World"
#a) Write an IF statement.
# If $a is greater than 5,
# write "Big" otherwise write "Small".
#b) Write the following logic in an IF/ELSE statement.
# Print "BIG WORLD" if $b is longer than 5 characters and has the word "World" in it.
# Print "BIG NO WORLD" if $b is longer than 5 characters and does not have the word "World" in it.
# Print "SMALL WORLD" if $b is not longer than 5 characters but has the word "World" in it.
# Print "SMALL NO WORLD" if $b is not longer than 5 characters and does not have the word "World" in it.
#c) Write an IF/ELSE statement for the following logic.
# If $b's length is 0, print "empty".
# If $b's length is between 0 and 11, print "short".
# Otherwise, print "long".
#d) Create another IF/ELSE statement that evaluates the data in the $c variable in some way. Be creative.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started