'LinKin Posted February 15, 2014 Share Posted February 15, 2014 Hi, For example I have this: Function bla() local car = getPedOccupiedVehicle(localPlayer) if isElementInWater(car) == false then return end -- random code below end If the if condition is true (car is not in water) so it returns, so the code below the function is not processed But what happens if I have something like this Function if not isGuestAccount(player) then if isElementInWater(car) then return end -- random code end -- more random code end So, if the condition is true and it returns, would the 'more random code' be proccessed? Link to comment
Moderators Citizen Posted February 15, 2014 Moderators Share Posted February 15, 2014 The answer is no. The return keyword just stop the execution of the function, even if it's inside an if statement or a loop. Link to comment
Bonsai Posted February 15, 2014 Share Posted February 15, 2014 return ends the function immediately. Rest of the function isn't taken care of. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now