Escape Nesting Hell - Do This Instead

preview_player
Показать описание
Learn how to improve your if statements in Unity to make them cleaner, more readable and easier to maintain using guard clauses.

SUBSCRIBE
Рекомендации по теме
Комментарии
Автор

Being able to make your code look like a flat list of instructions vs some kind of pyramid shape is really overlooked but it's a total lifesaver when you're hunting bugs.

codichor
Автор

I've always heard this referred to as an "early exit". It is one of the easiest ways to greatly improve readability.

Nerdsown
Автор

Beginner programmers, take notes! Readability and structure is king in systems

cappydev
Автор

I have been using this approach for 5 years now. Everywhere from servers to frontend to Unity.

Never knew it was called guard clause.

Ishanatmuz
Автор

That is actual genius. I've had so many cases where this was a real problem having so many stacking if statements. Great tip

dorky
Автор

YandereDev HATES this man for using these simple tips !!!

spiralingspiral
Автор

These are exactly the sort of Unity videos I have been searching for, concise, informative and actually applicable. Please continue to make more!

elriano
Автор

Concise yet informative! Love seeing videos that don't unnecessarily bloat simple concepts.
For those looking for more videos of this nature (code structure and design), search for that and leave out things like Unity and C#. It's general programming advice you're looking for. Which is the same whether you're making a game, website, api... You get it.

SolironBrightwoode
Автор

I have no words.. as soon as I realised what you were doing my mind was blown and my code will be changed for the better forever. Thank you!

lorderu
Автор

Been programming for a few years now, always had an instinct to take advantage of the empty else but I never thought of this. Thank you so much <3

chosencode
Автор

This is amazing. Guard clauses! I will be using them from now on. Thank you.

LeeG
Автор

I wish someone showed me this when I was starting out. This make both code easier to read but also so much easier to teach and understand.
You should make a bunch more of these and in the same 'snack' sized way..

Thanks man, this is an eyeopener.

LazerMarsupial
Автор

a very nice, short and informative video! You explained so well in such a small amount of time! Thanks

sundarakrishnann
Автор

I've beem programming for 10 years, not games, but this is a really good way to explain this.

The way I visualise it is like a freeway, with exits. Most traffic goes along the freeway, but if there are certain conditions, they will exit with certain actions as per the criteria.

marzzbar
Автор

It is always good to have a reminder of good practices and patterns.
thank you for sharing!

pliniomourao
Автор

More tutorials like these are NEEDED on YouTube thank you!! I've always looked for things like this and having a video going over it is incredibly helpful

FunkyAnimations
Автор

this is the kind of thing that make sense, but didn't think about until now. Thank you very much. Not a solve all for everything, but i feel like i can do great work with it.

Exas
Автор

Brilliant, please make more videos man, you're explaining so well!

SelaMalka
Автор

Simple, clear, straight to the point. I really like it, keep it up!

lucasfarias
Автор

This was a game changer for me when I first started writing code like this.

lyons