Please, merge my PowerShell examples for all chapters (#106)
* PowerShell 01_introduction_to_algorithms example * PowerShell 02_selection_sort example * PowerShell 03_recursion examples * PowerShell 04_quicksort examples * PowerShell 05_hash_tables examples * PowerShell 06_breadth-first_search example * PowerShell 07_dijkstras_algorithm example * PowerShell 08_greedy_algorithms example * Powershell 09_dynamic_programming example
This commit is contained in:
committed by
Aditya Bhargava
parent
d7de908a82
commit
06ee65d9e5
2
05_hash_tables/PowerShell/01_price_of_groceries.ps1
Normal file
2
05_hash_tables/PowerShell/01_price_of_groceries.ps1
Normal file
@@ -0,0 +1,2 @@
|
||||
$book = @{"apple" = 0.6; "milk" = 1.49; "avocado" = 1.49}
|
||||
Write-Host ($book | Out-String)
|
||||
18
05_hash_tables/PowerShell/02_check_voter.ps1
Normal file
18
05_hash_tables/PowerShell/02_check_voter.ps1
Normal file
@@ -0,0 +1,18 @@
|
||||
$voted = @{}
|
||||
function Check-GRKVoter
|
||||
{
|
||||
param($name)
|
||||
if ($voted.Contains($name))
|
||||
{
|
||||
Write-Host "kick them out!"
|
||||
}
|
||||
else
|
||||
{
|
||||
$voted[$name] = $True
|
||||
Write-Host "let them vote!"
|
||||
}
|
||||
}
|
||||
|
||||
Check-GRKVoter tom
|
||||
Check-GRKVoter mike
|
||||
Check-GRKVoter mike
|
||||
Reference in New Issue
Block a user