How to Teach an Old Guy Programming

Old No Comments on How to Teach an Old Guy Programming 18

Happy Birthday, you’ve just hit {Get-Random} and you’re wondering to yourself, “Can I learn to program?” Or maybe you have some basic programming knowledge but just don’t know where to start. Perhaps you just need a campout and a new perspective on how the Powershell scripting language works. Like a good fire side story, programing tells the story to your computer…

“Once upon a time it was a clear beautiful night for a campout. There are a million stars in the sky. Let’s build a campfire and put a hundred sticks in it. Then my friends, Brian, Chris, and Mike will start telling stories. We’ll listen till someone starts talking about the motorcycle accident because we all know how that one ends. We’d fall asleep and wake up in the morning for another adventure.”

clear
 
$beautiful = "true"
$night = "true"
 
if ($night -eq $beautiful)
    {$campout = "true"}
else
    {$campout = "false"}    
 
$stars = 1000000
 
$fire = $null
 do {$fire++}
until ($fire -gt 100)
 
$myfriends = @("Brian","Chris","Mike")
 
foreach ($friend in $myfriends)
    {
        $randomstory = Get-Random -minimum 1 -Maximum 5
 
        switch ($randomstory)
            {
            1 {$story = "Once upon a time..."}
            2 {$story = "One time on my motorcyle I..."}
            3 {$story = "Spock is cool"}
            4 {$story = "I think I need a vacation"}
            5 {$story = "I should have mowed my grass"}
            default {$story = "blah, blah, blah"}
            }
 
            write-host "$friend says, '$story'"
 
            if ($story.contains("motorcyle"))
             { write-host $myfriends "yell, 'Here we go again.'"}
    }
 
Get-Date
   
$seconds = 10
Sleep $seconds
 
$nextday = (Get-Date).AddDays(1)
$nextday.DateTime

Author

David D Dorsett

Specialties: System Engineer • GMP Validation • Networking • Windows/Linux • SCCM • Powershell

Related Articles

Leave a comment

Back to Top