Jump to content

Using var in Function


Recommended Posts


I have the below function. I want to send different variable names to this function, and return the result back to where this func is called with different var names. Something like this when calling this func in another func maybe.

addComma($oldname, $newname)

So it sends the variable $oldname to this func and return it with $newname to where it's been called.

How do I do it?


Func addComma()
Dim $t, $final

$Var = 123456789

$result = StringSplit($var, "")

For $x = $result[0] to 1 Step -1
    $t = $t +1
    If $t = 4 Then
        $final = "," & $final
        $t = 1
    $final =  $result[$x] & $final
    MsgBox(0, "Results", $final)


Edited by SaeidN
Link to comment
Share on other sites

  • Developers

Just open the Helpfile on the Return command and look at the Byref and Return options also shown in the Example.


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
Live for the present,
Dream of the future,
Learn from the past.

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

  • Recently Browsing   0 members

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