on 2aa3ed9 help sign in
25 lines 5.8 kB history raw
1# PowerShell script for testing syntax highlighting
3function Get-FutureTime {
4 param (
5 [Int32] $Minutes
6 )
7 
8 $time = Get-Date | % { $_.AddMinutes($Minutes) }
9 "{0:d2}:{1:d2}:{2:d2}" -f @($time.hour, $time.minute, $time.second)
10}
12if ($env:PATH -match '.*rust.*') {
13 'Path contains Rust'
14 try {
15 & "cargo" "--version"
16 } catch {
17 Write-Error "Failed to run cargo"
18 }
19} else {
20 'Path does not contain Rust'
21}
23(5..30) | ? { $_ % (2 * 2 + 1) -eq 0 } | % {"In {0} minutes, the time will be {1}." -f $_, $( Get-FutureTime $_ )}
24$later = Get-FutureTime -Minutes $( Get-Random -Minimum 60 -Maximum 120 )
25"The time will be " + $later + " later."