Why doesn't $iOne evaluate?
Function usage question
#1
Posted 22 February 2012 - 09:37 PM
Why doesn't $iOne evaluate?
#2
Posted 22 February 2012 - 09:45 PM
EDIT:Actually the way you're doing it, you'd need to use a different variable name in the function call Func _test($iTwo), because the variable inside your function is actually referencing the $iApple variable that was passed to the function.
Edited by BrewManNH, 22 February 2012 - 09:47 PM.
How to ask questions the smart way!
Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.
Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.
_FileGetProperty - Retrieve the properties of a file SciTE Toolbar - A toolbar demo for use with the SciTE editorGUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.
GUIToolTip UDF Demo - Demo script to show how to use the GUIToolTip UDF to create and use customized tooltips.
#3
Posted 22 February 2012 - 09:46 PM
For example:
Neither are allowed because of
ERROR: _test() called by a previous line with 1 arg(s)
Edited by mechaflash213, 22 February 2012 - 09:50 PM.
#4
Posted 22 February 2012 - 09:48 PM
How to ask questions the smart way!
Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.
Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.
_FileGetProperty - Retrieve the properties of a file SciTE Toolbar - A toolbar demo for use with the SciTE editorGUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.
GUIToolTip UDF Demo - Demo script to show how to use the GUIToolTip UDF to create and use customized tooltips.
#5
Posted 22 February 2012 - 09:50 PM
Default is that the value is passed down to the Func and you cannot screw up the original content of the Variable used in the Func call.
Edited by Jos, 22 February 2012 - 09:50 PM.
Visit the SciTE4AutoIt3 Download page for the latest versions Forum Rules
Live for the present,
Dream of the future,
Learn from the past.
#6
Posted 22 February 2012 - 09:52 PM
#7
Posted 22 February 2012 - 09:56 PM
Have you RTFMed at all before asking these questions?See my example from the previous post.
It seems to me pretty clear that it is impossible to call a FUNC with a Pararmeter and have the FUNC declared without any.
Visit the SciTE4AutoIt3 Download page for the latest versions Forum Rules
Live for the present,
Dream of the future,
Learn from the past.
#8
Posted 22 February 2012 - 10:30 PM
Have you RTFMed at all before asking these questions?
There's your one poke
I think I got it now tho... tell me if I'm wrong:
$iApple gets passed as an argument and $iOne captures it, no matter what.
If you don't declare Const or ByRef, $iOne doesn't change $iApple, however, you can perform operations against $iApple in the function.
If $iOne is declared a Const in the function, nothing is allowed to change it, however you can still change the value of $iApple.
If $iOne is declared as a ByRef, whatever $iOne evaluates to is mirrored to $iApple inside and outside of the function.
And am I right to say that RTFM evaluates to "Read The Fucking Manual" ? If not sorry for cussing
Edited by mechaflash213, 22 February 2012 - 10:32 PM.
#9
Posted 22 February 2012 - 10:32 PM
You might find the Variables - using Global, Local and ByRef tutorial in the Wiki useful reading.
M23
Toast - Small GUIs which pop out of the Systray   Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI   NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure   Notify - Small notifications on the edge of the display
RecFileListToArray- An alternative to _FileListToArray with user-defined include/exclude masks, maximum recursion level, sorting and displayed path options
GUIListViewEx - Insert, delete, move, drag and sort ListView items
#10
Posted 22 February 2012 - 10:38 PM
Just to be clear, if you just assign a value to a variable before declaring it, it is defaulted to a Global type? Same with DIM ing a variable?
#11
Posted 22 February 2012 - 10:43 PM
It is best not to use Dim as it forces AutoIt to determine the scope of the variable using its own simplistic logic - within a function = Local, elsewhere = Global. So merely declaring a variable does not set its scope to Global unless it is outside a function. It is much better coding practise to declare the scope explicitly yourself - then you can be sure that you have what you want.
M23
Toast - Small GUIs which pop out of the Systray   Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI   NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure   Notify - Small notifications on the edge of the display
RecFileListToArray- An alternative to _FileListToArray with user-defined include/exclude masks, maximum recursion level, sorting and displayed path options
GUIListViewEx - Insert, delete, move, drag and sort ListView items
#12
Posted 23 February 2012 - 03:18 PM
And am I right to say that RTFM evaluates to "Read The Fucking Manual" ?
That could be one interpretation, although I prefer "Read The Fantastic Manual".
#13
Posted 23 February 2012 - 04:14 PM
Visit the SciTE4AutoIt3 Download page for the latest versions Forum Rules
Live for the present,
Dream of the future,
Learn from the past.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users





