Jump to content

Multiple function calls or use a variable

Recommended Posts


If a function returns a simple result such as a string or number,  I normally just call the function without assigning the returned value to a variable, e.g

FileWriteLine($h_LogFile, FileGetVersion($s_File, $FV_FILEDESCRIPTION) & @CRLF)

If I am going to use the returned result multiple times within the same function, I normally create a variable and store the value in it.

$s_Description = FileGetVersion($s_File, $FV_FILEDESCRIPTION)
FileWriteLine($h_LogFile, $s_Description & @CRLF)

; use $s_Description a few more times  later...

I was just curious what others did. From a speed point I guess there isn't much difference, but it does save creating a Local variable.

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


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.