Tuesday, September 02, 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 http://www.autohotkey.com/forum/topic29752.html) 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)

    • Mon 01-Sep-14
      Hi from France Download's link for the J3.1.1 version of JQW is broken ... have a nice day, Thanks ...
  • Joes Word Cloud (JWC)

    • Sat 23-Aug-14
      Salut Joe, Thank you again for helping me. I had installed V2.2 for Joomla 2.5. Finally, as you ...
    • Wed 20-Aug-14
      Salut Nathalie! I could only access the under construction page of your website, so I'm not 100% sure.
    • Tue 19-Aug-14
      Hi Joe, Thank you for your prompt reply. Below, an "image" of the cloud on my website : "pour ante ...
    • Mon 18-Aug-14
      Hi Nathalie, Thanks for the message. The module does not see Virtuemart text but that sounds like ...