Jump to content

(solved) EndFunc if... ?


Recommended Posts

How would one implement something like

test()

Func test()
    if WinExists('windowXYZ')Then
        MsgBox(0,'','window exists')
        EndFunc
    EndIf

    MsgBox(0,'',"window doesn't exist")

EndFunc

It throw's an error "missing EndIf" if the windowXYZ exists.

Edited by level20peon
Link to comment
Share on other sites

EndFunc acually tells the interpreter that the section dedicated to the punction's code is finished

to exit a function you must use Return

you can use return or return + a value

$a=_func1()
$b=_func2()

msgbox(0,"",$B)
msgbox(0,"",_func2()) ;they will return the same thing =)

Func _func1()
if 1=1 then 
 msgbox(0,"","This will return nothing")
 return
endif

msgbox(0,"","This Code Won't Be Executed because of the return!")
endfunc

Func _func2()
 msgbox(0,"","This will return some text")
 return "some text"
 msgbox(0,"","This Code Won't Be Executed because of the return!")
endfunc

I hope I was clear :)

Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...