DrSchool Learn coding, fast.
EN AR BN CS DE EL Search

Conditionals — Example 66

Quick explanation + ready code for: Conditionals.

PowerShell Conditionals Back to examples
Back to language
Syntax: Conditionals in PowerShell. ID: #66

Code

$n=16
if($n%2 -eq 0){ "even" } else { "odd" }

Notes

You can copy this snippet and adapt it. For advanced, add real-world inputs, edge cases, and tests.