RosettaCodeData/Task/Inverted-syntax/PowerShell/inverted-syntax-2.ps1

9 lines
218 B
PowerShell
Raw Permalink Normal View History

2026-04-30 12:34:36 -04:00
function Action ([scriptblock]$Expression, [Alias("if")][bool]$Test)
{
if ($Test) {&$Expression}
}
Set-Alias -Name say -Value Action
say {"Thank God it's Friday!"} -if (Get-Date 5/27/2016).DayOfWeek -eq "Friday"