Jump to content
Sign in to follow this  
Hypertrophy

returning a value in a func

Recommended Posts

Hypertrophy

Func GetInfo($value)
    $list = WinList("[CLASS:QWidget]")
    For $n = 1 To $list[0][0]
        Return $list[$n][0]
    Next
EndFunc

Would this function return all the windows that i got from WinList()?

Could I use these windows that I got from WinList() with GetInfo($value)?

Share this post


Link to post
Share on other sites
Izebize

It will return only the first window, because if you use Return statment then it exits from the function, and gives back the result wich is $list[1][0].

Share this post


Link to post
Share on other sites
Hypertrophy

I'm lost. Can you tell me how to return values from functions and use them in other parts of my code because I cannot understand the helpfile.

I feel like I'm screwed because I'm trying to count the number of lines in a file for specific types of windows that are open. thats why i tried creating this function because I can't manually specify the file to count the lines from, it has do do it for each of those types of windows

>_< :(:(

Edited by Hypertrophy

Share this post


Link to post
Share on other sites
Rarst

Return interrupts function and gives "outside" any value that it is executed with. You cannot execute multiply returns because the very first jumps out of function into place where it was called from. If you want to return few values you can store it in array and return that array.

I am not sure what you are trying to do in example because you aren't using $value that you are passing to the function for anything.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.