Simpel Posted January 25, 2019 Posted January 25, 2019 (edited) Hi. Yesterday I read here (https://en.wikipedia.org/wiki/%3F) about ternary operator and it's different behaviour in programming languages. At the end I assigned a variable with ternary operator depending on an other variable. That's what it looks like: Local $sVehicleShort ='t' Local $sVehicleLong = $sVehicleShort = 'b' ? 'bus' : _ $sVehicleShort = 'a' ? 'airplane' : _ $sVehicleShort = 't' ? 'train' : _ $sVehicleShort = 'c' ? 'car' : _ $sVehicleShort = 'h' ? 'horse' : _ 'feet' ConsoleWrite('VehicleLong: ' & $sVehicleLong & @CRLF) Simpel Edited January 25, 2019 by Simpel typo SciTE4AutoIt = 3.7.3.0 AutoIt = 3.3.14.2 AutoItX64 = 0 OS = Win_10 Build = 19044 OSArch = X64 Language = 0407/german H:\...\AutoIt3\SciTE H:\...\AutoIt3 H:\...\AutoIt3\Include (H:\ = Network Drive) Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.
Moderators JLogan3o13 Posted January 25, 2019 Moderators Posted January 25, 2019 What would be the benefit of this over a traditional Switch? The Switch would definitely be more readable. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now