|
| 30 Jan 2013 01:31 PM |
for i = 1,10 do if i == 5 then *exit for loop* end end |
|
|
| Report Abuse |
|
|
digpoe
|
  |
| Joined: 02 Nov 2008 |
| Total Posts: 9092 |
|
|
| 30 Jan 2013 01:32 PM |
break breaks out of the current loop. Example:
for i = 1, 10 do print(i) if i == 5 then break end end
Output: 1 2 3 4 5 |
|
|
| Report Abuse |
|
|
velibor
|
  |
| Joined: 24 Nov 2009 |
| Total Posts: 1003 |
|
|
| 30 Jan 2013 01:32 PM |
for i = 1,10 do if i == 5 then break end end
That will exit the loop. You can also use return.
|
|
|
| Report Abuse |
|
|
|
| 30 Jan 2013 01:35 PM |
| Won't that completely end the script? I want my script to continue after the for loop. |
|
|
| Report Abuse |
|
|
digpoe
|
  |
| Joined: 02 Nov 2008 |
| Total Posts: 9092 |
|
|
| 30 Jan 2013 01:36 PM |
break 'breaks' out of the current loop, such as while true do. return is meant for functions, such as this:
function isPlayer(thing) return thing:GetPlayerFromCharacter() end
print(isPlayer(workspace.Player1)) |
|
|
| Report Abuse |
|
|