Skip to content

Commit 4f57dcb

Browse files
marcelgrubermichaellwest
authored andcommitted
Beef up example for how to read the user input
1 parent 0170994 commit 4f57dcb

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

appendix/common/read-variable.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ Help Author: Adam Najmanowicz, Michael West
156156

157157
### EXAMPLE 1
158158

159-
The following provides a dialog with a dropdown of options.
159+
The following provides a dialog with a dropdown of options, and how to read the selected value.
160160

161161
```powershell
162162
$options = @{
@@ -175,7 +175,12 @@ $props = @{
175175
ShowHints = $true
176176
}
177177
178-
Read-Variable @props
178+
$result = Read-Variable @props
179+
180+
if($result -eq "ok")
181+
{
182+
Write-Host "You chose: $($selectedOption)"
183+
}
179184
```
180185

181186
### EXAMPLE 2
@@ -235,6 +240,9 @@ if($result -ne "ok")
235240

236241
### EXAMPLE 4
237242

243+
```
244+
245+
```
238246

239247
## Related Topics
240248

0 commit comments

Comments
 (0)