Sign in to follow this  
Followers 0
BinaryBrother

Possible bug? If _Test <> 0 Then; No error

6 posts in this topic

#1 ·  Posted (edited)

SS: http://screencast.com/t/m4OYIICM

Replicator code.

If _Test <> 0 Then
     ;
EndIf
 
Func _Test()
     MsgBox(16, "", "")
EndFunc

Console output

>"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Users\Owner\Dropbox\!Projects\!AutoIt\!Active\TeamViewer_Manager\TEMPTESTING.au3" /UserParams   
+>16:24:40 Starting AutoIt3Wrapper v.2.1.4.4 SciTE v.3.3.7.0 ;  Keyboard:00000409  OS:WIN_7/Service Pack 1  CPU:X64 OS:X64    Environment(Language:0409  Keyboard:00000409  OS:WIN_7/Service Pack 1  CPU:X64 OS:X64)
>Running AU3Check (3.3.10.2)  from:C:\Program Files (x86)\AutoIt3
+>16:24:40 AU3Check ended.rc:0
>Running:(3.3.10.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Users\Owner\Dropbox\!Projects\!AutoIt\!Active\TeamViewer_Manager\TEMPTESTING.au3"   
--> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop
+>16:24:40 AutoIt3.exe ended.rc:0
+>16:24:40 AutoIt3Wrapper Finished..
>Exit code: 0    Time: 0.550

Notice I left out the parenthesis on "_Test()"? Shouldn't this throw a compiler or syntax error? It doesn't on my build.

Thank you guys for all your time and for being patient. I know I've been asking a few annoying questions lately.

Edited by BinaryBrother

Share this post


Link to post
Share on other sites



Why do you thing there's an error? What error you expected?


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

It doesn't actually call the function. Let me give a better example. It took me a little while to find an error in my code because of this. Is this not technically bad syntax? This is why I like bringing things to chat, before posting bug reports. I could be wrong; I probably am.

 

If _Test = 0 Then
     ConsoleWrite("Returned correctly.")
Else
     ConsoleWrite(_Test2) ;Nothing
EndIf
 
Func _Test()
     Return 0
EndFunc
 
Func _Test2()
     Return "Hello"
EndFunc

I am expecting a compiler error to say "Bad Syntax, you forgot parenthesis!"

Edited by BinaryBrother

Share this post


Link to post
Share on other sites

Then this code will surprise you when you run it:

$vPrintFunc = ConsoleWrite

$vPrintFunc("WTF!" & @CRLF)

Anyway, search around the forum (and internet) for term "first class".

1 person likes this

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Oh snap! That's a very interesting development!

Edit: Alright, I'm back after reading a while on it. This is some pretty interesting stuff. I'm surprised to see it was actually implemented some time ago. I think I remember reading about it before but had forgotten about it. No matter how long I stare at that example you gave me, I just can't wrap my head around it. I see a multitude of new possibilities, I think.

Do you have a few practical examples that you could point out - right off the top of your head? If not, don't worry about it. I'll do some digging as time permits.

Thanks for the information trancexx. As always, you have my gratitude for being informative and patient.

Edited by BinaryBrother

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

BinaryBrother,

 

Do you have a few practical examples that you could point out

Look at the code in this post - a function is assigned to the $hType variable which is then passed to a function as a parameter ($hDataType) for use within the function.

M23

Edit: That code has now been removed. Look at the example for _ArrayDisplay in the latest Beta which shows the same thing - a function is assigned to the $hUserFunction variable which is then passed to the function as a parameter for use within it: :)

; Assign the user function to a variable to pass as a parameter
Local $hUserFunction = _UserFunc

$aArray_2D[5][5] = "Column alignment set to right"
_ArrayDisplay($aArray_2D, "Range set - right align - copy column width - user function", "3:7|4:9", 2, 15, "AA|BB|CC|DD|EE|FF", Default, Default, $hUserFunction)
Edited by Melba23
1 person likes this

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
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
Sign in to follow this  
Followers 0