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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!