Is single line coding a bad practice like trying to put functions or what ever into one line

Title says it all should we be open minded about single line coding or should it be avoided at all costs i personally try to avoid it because it becomes a mess but sometimes it can be handy

if a new coder makes a habit of one line coding should they break it
example of some bad habits

local function SomeFunc() –code goes here SomeFunc()

or repeat until on one line

there is also plenty more

If you’re writing short things and want to minimize unnecessary line usage, there is typically no issue with it. Regardless, there is never an “issue” when formatting code; only when you are trying to interpret it later. If it’s something like this:

if debounce then return end

That isn’t messy and looks better than:

if debounce then
    return
end

Hope this helps.

1 Like

i mean like even for i, v in pairs in one line yikes!

1 Like

for _, instance in ipairs(workspace:GetDescendants()) do if instance:IsA("BasePart") then print(instance.Name) end end

This is a fairly bad code practice. For improved readability you should correctly linebreak & indent your code.

2 Likes