Lua in Neovim: Break and Nested Loops — Star Patterns & Finding Divisible Numbers | Episode 11
3views
007:50
T
Taught by Celeste AI - AI Coding Coach
View on YouTubeDescription
Take full control of loop flow! In this episode we use break to exit loops early, build star rectangle and
triangle patterns with nested for loops, and find the first number divisible by both 7 and 13 — seeing that
break only exits the innermost loop.
Every keystroke is shown on screen with 3-second pauses so you can follow along at your own pace.
What You'll Learn:
- break — exit the current loop immediately
- Nested for loops — a loop inside another loop
- Star rectangle: outer loop rows, inner loop columns
- Star triangle: inner loop count grows with outer counter
- Finding the first number divisible by both 7 and 13
- break only exits the innermost loop
Source Code:
https://github.com/GoCelesteAI/learn-lua-in-neovim
Timestamps:
0:00 Intro
0:12 Preview
0:44 Star Rectangle (nested for loops)
2:30 Star Triangle (inner loop varies)
4:22 Break (find first divisible by 7 and 13)
6:18 Recap
6:50 Endscreen
Key Takeaways:
1. break exits the current loop immediately
2. Nested loops use one loop inside another
3. Each loop counter is independent and local
4. break only exits the innermost enclosing loop
5. Nested loops build grids, tables, and search patterns
This is Episode 11 of the Learn Lua in Neovim series. New episodes cover functions, multiple returns, scope,
and more — all coded inside Neovim.
Taught by CelesteAI. Like & subscribe for more tutorials!
#lua #neovim #programming #tutorial #beginners #learnlua #luaprogramming #neovimtutorial #nestedloops
#luabreak #coding
Tags
lua, lua tutorial, learn lua, lua break, lua nested loops, lua for loop, lua break statement, lua star
pattern, lua rectangle, lua triangle, lua nested for, lua divisible numbers, lua loop control, lua for
beginners, neovim lua, neovim tutorial, learn lua in neovim, lua episode 11, programming tutorial, coding
tutorial, beginner programming, lua 2026, neovim 2026, screenkey, code along, lua basics, lua control flow
Tags
lualua tutoriallearn lualua breaklua nested loopslua for looplua break statementlua star patternlua rectanglelua trianglelua nested forlua divisible numberslua loop controllua for beginnersneovim lua