-- Example Lua code demonstrating the use of the 'break' statement
-- Define a loop that runs from 1 to 5
for i = 1, 5 do
-- Print the current value of 'i'
print("Current value of i:", i)
-- Check if 'i' is equal to 3
if i == 3 then
-- If true, break out of the loop
print("Breaking out of the loop at i = 3")
break
end
-- Print a message indicating the continuation of the loop
print("Continuing to the next iteration")
end
-- Output:
-- Current value of i: 1
-- Continuing to the next iteration
-- Current value of i: 2
-- Continuing to the next iteration
-- Current value of i: 3
-- Breaking out of the loop at i = 3