-
Notifications
You must be signed in to change notification settings - Fork 0
/
test1.ps1
44 lines (23 loc) · 836 Bytes
/
test1.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
[string]$playerInput = ""
[bool]$proceed = $false
Clear-Host
function getPlayerInput() {
while ($proceed -eq $false) {
$playerInput = read-host -prompt "You walk into a room with two doorwarys. One to the left and one to the right. Type 'left' or 'right' to walk through one of the doors."
if ($playerInput -eq "left") {
$proceed = $true
break
}
elseif ($playerInput -eq "right") {
$proceed = $true
break
}
else {
write-host "You must type 'left' or 'right' to proceed."
}
}
return $playerInput
}
$playerInput = getPlayerInput
write-host "You entered" $playerInput
read-host "Press any key to continue..."