Jump to content

Local vars


inlander
 Share

Recommended Posts

When using the Local keyword on a variable within a function, such as in the example:

 
Func Example()
    ; Retrieve the data stored in the clipboard.
    Local $sData = ClipGet()
...
 
EndFunc   ;==>Example
 
is this local to the function, or local to the script?  If local to the function, how would I declare it local to the script?
(I want to check it outside the function.)   Can a function return a value, as in most other languages?
 
Also, I am not used to on-the-fly declarations with an assignment.  How is a variable explicitly declared?
 
TIA for your help.
Inlander
Link to comment
Share on other sites

could be.

1

global $data=""

 

func getdata()

$data=clipget

endfunc

2

local $data=getdata()

func getdata()

return=clipget()

endfunc

3

also could use byref.

Edited by Danyfirex
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...