Wednesday, July 30, 2014
Text Size

AutoHotkey Ternary Operator

Just a quick note for the moment on how to use ternary operators in AutoHotkey.  A ternary operator for those who are unfamiliar with this is an "If...Then...Else..." statement written in a small amount of code, usually on one line, and exists in most programming languages.

For Example, the statement:


  1.  If (ThisCondition = true) 
  2.      ThisVar:=1 
  3.  Else 
  4.      ThisVar:=2 

Converted to Ternary this would look like:

  1.  ThisVar:=(ThisCondition = true) ? 1 : 2 
I'll add as there are a whole bunch of methods using the Ternary Operator in AutoHotkey (discussed on which I'll put in soon. I just needed something on my site now as I find myself looking for this bit of info every now and again.


# iBob35555VR Thu, 26th July 2012
Oh ok So
Var := (Condition) ? Return_if_true : Return_If_false

Nice =P
Like | Dislike | 0 Reply | Reply with quote | Quote
Add Comment





Latest Posts

  • Joes Quicklist Weblinks (JQW)

    • Thu 17-Jul-14
      Hi, thanks a lot. But I have got a problem with download it. Error: "File could not be found Important!
    • Tue 15-Jul-14
      Hi Artur, I forgot to get back to you sooner. I was going to include a set of instructions to do this ...
    • Mon 14-Jul-14
      Hi Skarosg, Not sure if we took this to e-mail but I noticed your site is displaying the images now.
    • Fri 11-Jul-14
      Hi, How can I put user name and category of weblink in module, near the date? Thanks..
  • Joes Word Cloud (JWC)

    • Tue 17-Jun-14
      I'm using JE 3.1.19 stable.