benners

Multiple function calls or use a variable

1 post in this topic

#1 ·  Posted

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