Jump to content

Recommended Posts

Posted

Not much to say ..

To save words simply try to run this code:

call("test")

Func test()
$test = "working"
Call("func1")
EndFunc

Func func1()
MsgBox(4096,"test",$test)
EndFunc

The variable $test is not saved if it is in the function.

This basic problem prevents me from continuing to program what I want.

I have the variable will remain even after the exit from the function ..

I do not understand why the system works that way ..

Posted

Yes. But with call you are limited. You can't use ByRef which for me personally is a deal breaker.

I would learn to call functions the way everyone else does though. it will make getting help on the forums much easier.

I've never seen anyone use the Call before.

Posted

Why add another variable?

It also works:

$test = test()
Call("func1")

Func test()
$test = "working"
Return $test
EndFunc

Func func1()
MsgBox(4096,"test", $test)
EndFunc

It's only with one variable.

There is another situation that I have to show.

Posted (edited)

$a = test() ;$a will equal the first thing test returns

$v1 = 5
$v2 = 10

for $i = 1 to $v1 step 1
test()
Next

Func test()
for $o = 1 to $v2 step 1
$a = $o
Return $a ;the function returns the value $a is currently set to in this case the loop is pointless and will always return the number 1
test2() ;this never executes
Next
EndFunc

func test2()
for $q = 1 to 20 step 1
msgbox(4096,"working",$a)
Next

Edited by Deltron0

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...