Skip to Content
Lua Quick Start Guide
book

Lua Quick Start Guide

by Gabor Szauer
July 2018
Beginner
202 pages
5h 42m
English
Packt Publishing
Content preview from Lua Quick Start Guide

Repeat until loop

A repeat until loop is slightly different from a while loop. When using a while loop, the initial expression is evaluated first, so the following code would not execute the chunk of code belonging to the loop:

while false do  print ("Not going to print")end

This happens because the Boolean condition of the loop is evaluated before the chunk of code is executed. A repeat until loop works the opposite way. The chunk of the repeat loop is executed first, then the condition is evaluated. This guarantees that a repeat until loop will execute its chunk at least once.

Syntactically, the repeat until loop begins with the repeat keyword, followed by the chunk of code to loop. The chunk ends with the until keyword, which is followed ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning Lua Programming

Beginning Lua Programming

Kurt Jung, Aaron Brown
Vim Masterclass

Vim Masterclass

Jason Cannon

Publisher Resources

ISBN: 9781789343229Supplemental Content