; Help > AutoIt > Keyword Reference > Func...Return...EndFunc ; Help > AutoIt > Function Reference > Misc. Management > ExpandVarStrings ; \AutoIt3\Examples\Helpfile\AutoItSetOption.au3 ;#include ;; Today() Not needed #include ;; _Max() #include Opt("ExpandVarStrings", 1) ;1=expand, 0=don't expand ;; "$var$", "@macro@" Example() Func Example() ; Sample script with two user-defined functions. ; Notice the use of variables, ByRef and Return. Local $iFoo = 2 Local $iBar = 5 MsgBox($MB_SYSTEMMODAL, "", " 1a. Works: Today is " & Today() & "@CRLF@ 1b. Fails: $iFoo equals $iFoo$ ") ; 1a Works. ; 1b Fails Swap($iFoo, $iBar) MsgBox($MB_SYSTEMMODAL, "", "After swapping $iFoo and $iBar: @CRLF@ 2. Fails: $iFoo now contains $iFoo$ " ) ; 2. ; Fails MsgBox($MB_SYSTEMMODAL, "", "Finally: @CRLF@ 3. Works: The larger of 3 and 4 is " & _Max(3, 4)) ; 3. ' Works with & EndFunc ;==>Example Func Swap(ByRef $vVar1, ByRef $vVar2) ; Swap the contents of two variables. Local $vTemp = $vVar1 $vVar1 = $vVar2 $vVar2 = $vTemp EndFunc ;==>Swap Func Today() ; Return the current date in mm/dd/yyyy form. Return '@MON@/@MDAY@/@YEAR@' ;; single(') or double(") quotes ; 4. ; Works EndFunc ;==>Today