Learning PowerShell – Homework Seven Answers

Share:
PowerShell

PowerShell Homework Seven

By: Steven Aiello

Answer the questions as best as possible in your own words. By answering the question in your own words you will learn more than simply repeating what you’ve heard. You are encouraged to visit the source links in the lessons to do more research on the subject.

Remember the point of the homework is not simply to finish, but to learn!

1. In your own words explain why in our stop light example in the lesson it’s possible to put any light color in any position in the if, elseif, else script

You could look phrase a stop like in an else statement like this:

If light –eq green go

Ifelse –eq yellow slow down

Else stop

2. In your own words what is the main difference between if and elseif when compared to else

If and elseif are be used to test various logic statements. The last “else” statement is a catch all if all of the other conditions are not met.

3. Write some pseudo-code using if, elseif, and else for what you would do if you were not hungry, hungry, really hungry.

If I’m not hungry sit on the couch

Elseif a little hungry eat a snack

Else eat a turkey

4. Take the pseudo-code from question three write a script where you assign a value to reflect your level of hungry and evaluate that variable using the family of if statements we have discussed.

(Your homework)

5. Give an example of an if, elseif, else type decision you make in your day to day life.

If morning get our of bed

Elseif bedtime get in bed

Else go about your day

Share:

Leave a reply

− one = two

This site uses Akismet to reduce spam. Learn how your comment data is processed.