Learn Lua in Neovim: Logical Operators — and, or, not & Ternary Idiom | Episode 8

15views
00
9:52
T
Taught by Celeste AI - AI Coding Coach
View on YouTube
Description
Combine conditions in Lua! In this episode we build a theme park ride checker using logical operators: `and` requires both conditions, `or` needs just one, and `not` inverts a boolean. We also cover the ternary idiom (`x and a or b`) for inline value selection. Every keystroke is shown on screen with 3-second pauses so you can follow along at your own pace. What You'll Learn: - `and` — both conditions must be true - `or` — at least one condition must be true - `not` — inverts a boolean value - The ternary idiom: `x and a or b` - Changing values with `ciw` to test different branches 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 & Variables 1:10 - AND: Both Conditions Must Be True 1:40 - Run: You Can Ride! (Both True) 2:00 - Change Age to 8 — AND Fails 2:20 - Run: Sorry, Not Allowed 2:40 - Restore Age to 12 3:00 - OR: At Least One Must Be True 3:40 - Run: Welcome to the Park! 4:00 - NOT: Inverts a Boolean 4:30 - Run: The Park Is Open! 4:50 - Ternary Idiom: and/or 5:20 - Run: Result: Pass 5:40 - Recap: Key Takeaways 6:12 - End Screen Key Takeaways: 1. `and` requires both conditions to be true 2. `or` passes when at least one condition is true 3. `not` flips true to false and false to true 4. `x and a or b` is the ternary idiom for inline value selection This is Episode 8 of the Learn Lua in Neovim series. New episodes cover loops, functions, tables, and more — all coded inside Neovim. Taught by CelesteAI. Like & subscribe for more tutorials! #lua #neovim #programming #tutorial #beginners #learnlua #luaprogramming #neovimtutorial #logicaloperators #andornot #ternary #coding Tags lua, lua tutorial, learn lua, lua logical operators, lua and or not, lua and operator, lua or operator, lua not operator, lua ternary, lua ternary idiom, lua boolean logic, lua conditions, lua combining conditions, neovim lua, neovim tutorial, learn lua in neovim, lua episode 8, programming tutorial, coding tutorial, beginner programming, lua 2026, neovim 2026, screenkey, code along, lua basics

Tags

lualua tutoriallearn lualua logical operatorslua and or notlua and operatorlua or operatorlua not operatorlua ternarylua ternary idiomlua boolean logiclua conditionslua combining conditionsneovim luaneovim tutorial
Back to tutorials

Duration

9:52

Published

March 5, 2026

Added to Codegiz

March 15, 2026

Open in YouTube