Jump to content

New ternary operator - Discussion


 Share

Recommended Posts

  • Moderators

MyEarth,

 

Bad bad example Melba lol

Does it work? Yes

Does it show the syntax? Yes

Was it part of a post to help people understand some of the new features? Yes

Didi it spark interest in the operator? Yes

Sounds like a result to me. ;)

If trancexx wants to provide better examples for the features she introduced then she has only to post them.

M23

Edit: Removed unpleasant comments and apologised to the target.

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

How am I supposed to know who wrote the example? Does it matter who wrote it?

I had to look up for the meaning of expression "to cast aspersions". Hm, I'm not sure how exactly did I deserve the comments I got from Melba23. Once again I've been accused for doing things I didn't even thought of.

Melba23, if you have something personal against me then please deal with that privately. PM me or whatever, say what you want to say and then leave me alone.

Edited by trancexx

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

Does it work? Yes

Does it show the syntax? Yes

Was it part of a post to help people understand some of the new features? Yes

Did it spark interest in the operator? Yes

Sorry to take a contrary view, but you would never actually write code like that, so I wouldn't want it in the helpfile.

TranceXX has already given an example where the operator actually provides new functionality rather than just a new syntax, and others have posted better examples.

Link to comment
Share on other sites

  • Moderators

Mat,

It was not in the Help file - it was in a post from a self-avowed hobbyist poster offering some assitance to the community on how the syntax for the new features actually work, as explained in the very lines you quoted. :mad2:

Anyway, as I have now learnt how poorly my attempt was regarded by others, I will not bother in the future and leave it to those who consider themselves better coders. If they can be bothered to do it, of course. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

It was not in the Help file - it was in a post from a self-avowed hobbyist poster offering some assitance to the community on how the syntax for the new features actually work, as explained in the very lines you quoted. :mad2:

Anyway, as I have now learnt how poorly my attempt was regarded by others, I will not bother in the future and leave it to those who consider themselves better coders. If they can be bothered to do it, of course. ;)

 

I didn't say it wasn't useful, I just said it was a bad example  :huh2:

Unfortunately you picked the one feature that is most likely to be abused in the future. That's probably why the users who have seen it in other languages were so quick to point that out to you.

Link to comment
Share on other sites

Better learn Arabic then. Apparently that's the most readable language?

 

I thought they had no vowels in written Arabic. I think that's one of the major problems in International relations: things often get lost in translation.

Ths sntnce hs n vwls.

I think what the world really needs is a Babel fish.

Edited by czardas
Link to comment
Share on other sites

I don't share this opinion. Arabic is a beautiful and very ornamentic script. Have you ever been to one of the arabic countries or south of spain?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

$ValueOfThisTopic = ($bMostlyArguing Or $bDiscussingArabic) ? -1 : 1

in the negatives i'm afraid...

On a side note, C, C++ and D allow the result to be used as an LValue so that you can conditionally modify/assign values to different variables:

(which ? x : y) += 5
Link to comment
Share on other sites

On a side note, C, C++ and D allow the result to be used as an LValue so that you can conditionally modify/assign values to different variables:

(which ? x : y) += 5

Which is what AutoIt should do, I believe it doesn't at the moment. The ternary I put into Disk Manager was returning true, not the output of the ternary concatenated with a string I appended.

Link to comment
Share on other sites

Good Code <----------------------------------------------------------------------------------------> Fun Code
Readable, Understandable, Maintainable, Self-Explanatory, Idiomatic, Efficient, Optimized, Elegant, Hackvalue

Also, AutoIt doesn't support ternary left hand values because assignment is not an equation operator.

Link to comment
Share on other sites

Just because you don't feel you will use it doesn't means others will. Try to look beyond your limitations as a developer.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Which is what AutoIt should do, I believe it doesn't at the moment. The ternary I put into Disk Manager was returning true, not the output of the ternary concatenated with a string I appended.

Referring to >this post:

$Export_File = (StringRight(StringLower($Export_File), 4) == ".dma") ? $Export_File : $Export_File & ".dma"

 

How do you suppose that is returning true?  I suspect you aren't fully grasping how the ternary operator, or AutoIt's interpreter, works. The condition is tested, if its TRUE then what comes between '? .. :' is evaluated, otherwise what follows ':' is evaluated.  After evaluation, if there is an assignment on the left hand side of the ternary expression, the result of the evaluated expression is then moved into that .

Optimizing compilers (which AutoIt isn't) could possibly fix that flawed code by doing a no-op or an append, but its better to fix the problem where it starts - at the programmer level.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...