Demystifying the Ternary Operator in AutoHotkey: Short-hand If-Else logic

TernAutoHotkey has pretty straight-forward If-Then-Else logic however it can take quite a few lines of code to do some simple evaluations.   Ternary Operators are a great way to write short / concise code in one line!  🙂

The basic form is that you first evaluate a condition.  If the value resolves to being true, the first parameter is returned.  If it is False, the second parameter is returned.

(Condition)?(True) : (False)

Ternary Operator video walk-through

Ternary Operator in AutoHotkey

 

Leave a Reply