Sign in to follow this  
Followers 0
AcidCorps

$Var = MyFunc()

4 posts in this topic

when creating arrays with _ArrayCreate you can simply put $MyArray = _ArrayCreate(Info)

how can I make it so that my function would use the same format for naming a variable

what I want to do is have a function detect the filename from an input

What I have so far is

GetFileName($iFullPath)

Global = $oFilename = StringTrimLeft($iFullPath,StringInStr($iFullPath,"/",1,-1))

EndFunc

Which name $oFilename the filename of the file

what I want however is for the function to put the filename of the file into $Filename using the line below:

$Filename = GetFileName($iFullPath)

So that the output variable can be changed without editing the function everytime

note that this is just an example I realize it's almost pointless to create a one line function but I want to learn how to do this anyways

Share this post


Link to post
Share on other sites

$x = GetNum ()

Func GetNum()

Return 7

EndFunc

$x now has 7 in it.

Share this post


Link to post
Share on other sites

Expanding on what Chip said, "Return" is the word you are looking for. Return will exit the function and return the value directly after the word "Return". So in Chip's example it returns 7.

Look in the helpfile for more details about Return.


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

Thanks, I had a feeling it was something simple like that.

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  
Followers 0