Luau has introduced new 'if local' and 'if const' syntax that allows developers to declare variables directly within conditional statements. This feature aims to streamline code by reducing nesting and improving type narrowing, though it currently only supports single-value bindings.
Vibe score
-100 to +100
This seems like a decent addition, I am curious about any sort of performance impact this might have though.
This topic was automatically opened after 11 minutes.
Is this slightly more performant because the variable is only created if the variable is not false or nil?
not really a great addition, removes a line of code, possibly even a step, by returning condition to if and also caching to variable, but not tuple formatted variables? honestly really pointless either way, and can make reading code give you a brain fart, when seeing that 5/10 for not really good or
I couldn’t really see the use-case for it when it was “leaked” via flags, but seeing the RFC I can see the appeal, although it still looks really cursed What I am curious on if this runs faster than doing it the traditional way?
If you read the RFC you could probably tell better why this is useful… Instead of complaining that we got a cool new feature you should maybe consider creating an RFC about your great idea.
Does this feature also include the syntax of while local player = findPlayer() do ... end Or is it currently limited to conditional statements only? Are there any plans of extending this support to loops as well? It would be really useful for pieces of code like this local i = 0 while true do local
This is so cursed, I love it. Does this properly scope said variables within the conditional block? If so, hot-diggity, I love this kinda rogue performance gain.
This is great, sure it’s not the prettiest, but I do find myself defining variables solely for the condition and variable within an if statement quite often.
Omg, how on earth am I going to find all of the examples of this in my codebase to clean them up and switch to this. Hate those variable checking chains. This only supports nil / false checking, right?
great now add switch statements to luau so I can have an even more cursed version of this local name = switch character case const player = Players:GetPlayerFromCharacter(character) => player.Name case const model = character:FindFirstAncestorOfClass("Model") => model.Name else => "Unknown"
Time to rewrite my framework I guess
This did seem redundant until I gave the RFC a lookie look. Indeed seems nice for situations as it states when you want to chain multiple condition checks on a tree of objects. Would be nice if the post used an example more like this. At the end of the day, purely boils down to preference and I thin
@Yarik_superpro rate this update and tell me if its good please teach me Master
Does this feature also include the syntax of while local player = findPlayer() do ... end while local support is in progress! We’re thinking of adding it under this beta when it’s completed
I love this SO SO much. There are a lot of places in my code that I do genuinely just want to pass a check and continue with that same variable. I always found myself hating the fact that I had to create a variable that I later won’t use, so this is basically a dream come true, no matter how funny i
Would be nice if the post used an example more like this. ah thanks for checking out the example in the RFC! We’ll update this post with a similar example
Nice convenience addition, sanity checks at least now can be streamlined
big fan of this, nice qol feature. tnx

How to get RLCS titles for FREE 🏷️🆓 #logicalrlmod #rocketleague #rocketleagueclips Made using Logical Rocket League Mod Logical lets you spawn in any item/title in the game as well as infinite credits! You can ...

When Math Doesn’t Math 😂 💀

A case that shocked Canada in 2012😳 #shorts

Hollywood Casting Indians Be Like

What Is Hugging Face and How To Use It HUGGING FACE TUTORIAL: The Ultimate Open-Source AI Platform for Beginners & Developers Book a Call with Me: ...
https://roblox-beta.apktodo.io/download/