Jump to content



Recommended Posts

return stops the function and returns a value or multiple values,

break, breaks the loop but doesn't stop a function

function aFunc( stopAt ) 
    local a; 
    for i = 1, 10 do 
        if i == stopAt then 
            a = i; 
            break; -- stops the loop but keeps executing rest of the function 
    end -- break hits end of the loop 
    -- do something else here 
    return a; 

Link to comment

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
  • Recently Browsing   0 members

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