Learn Lua in Neovim: If Statements — if, elseif, else & Grade Calculator | Episode 7
19views
007:40
T
Taught by Celeste AI - AI Coding Coach
View on YouTubeDescription
Make decisions in your Lua code! In this episode we build a grade calculator using if/then/end, add an else
fallback, and chain multiple conditions with elseif. We use cw (change word) to swap the score and re-run to
test each branch.
Every keystroke is shown on screen with 3-second pauses so you can follow along at your own pace.
What You'll Learn:
- if/then/end for conditional execution
- else for a fallback branch
- elseif for multiple conditions
- How Lua picks the first true branch
- cw to change a word in Neovim
Source Code:
https://github.com/GoCelesteAI/learn-lua-in-neovim
Timestamps:
0:00 - Introduction
0:12 - What You'll Learn (Preview)
0:44 - Creating the File & Score Variable
1:24 - First if/then/end Block
1:55 - Run: Nothing Printed (85 lt 90)
2:18 - Adding else for a Fallback
2:50 - Run: Grade F (Only Two Branches)
3:10 - Adding elseif Branches (B, C, D)
4:00 - Run: Grade B (85 gt= 80)
4:20 - cw: Change Score to 55
4:40 - Run: Grade F (55 lt 60)
4:55 - cw: Change Score to 92
5:15 - Run: Grade A (92 gt= 90)
5:35 - Final Print Line & Run
6:00 - Recap: Key Takeaways
6:32 - End Screen
Key Takeaways:
1. if condition then ... end runs code when the condition is true
2. else provides a fallback when no condition matches
3. elseif adds additional conditions to check in order
4. Lua picks the first true branch and skips the rest
This is Episode 7 of the Learn Lua in Neovim series. New episodes cover logical operators, loops, functions,
and more — all coded inside Neovim.
Taught by CelesteAI. Like & subscribe for more tutorials!
#lua #neovim #programming #tutorial #beginners #learnlua #luaprogramming #neovimtutorial #ifstatements
#conditionals #elseif #coding
---
Tags:
lua, lua tutorial, learn lua, lua if statement, lua if else, lua elseif, lua conditionals, lua conditional
logic, lua grade calculator, lua branches, lua then end, lua decision making, neovim lua, neovim tutorial,
learn lua in neovim, lua episode 7, programming tutorial, coding tutorial, beginner programming, lua 2026,
neovim 2026, screenkey, code along, lua basics, cw change word
Tags
lualua tutoriallearn lualua if statementlua if elselua elseiflua conditionalslua conditional logiclua grade calculatorlua brancheslua then endlua decision makingneovim luaneovim tutoriallearn lua in neovim