How to Avoid Multiple Nested If-Else Statements Using Guard Clause

  Рет қаралды 1,445

Emmanuel Pangan

Emmanuel Pangan

Күн бұрын

Пікірлер: 10
@itachi2011100
@itachi2011100 8 ай бұрын
this is called early exit pattern
@Emmanuel-Pangan
@Emmanuel-Pangan 8 ай бұрын
Never heard of that, guess, you learn everyday! Thanks btw.
@catprog
@catprog 7 ай бұрын
I like reporting all the errors and then exiting from the function. error = false; if(!isUsername){ error = true; console.log('bad username'); } if(!isPassword){ error = true; console.log('bad password'); } if(error) { return; }
@Emmanuel-Pangan
@Emmanuel-Pangan 7 ай бұрын
That's also a good way. Catching the errors first, sending the error message, and then exiting the function. This way, it prints all the possible errors before exiting the function.
@Emmanuel-Pangan
@Emmanuel-Pangan 8 ай бұрын
Well a bit late but... Happy New Year everybody! Also, I won't use TTS anymore so I hope you're ok with my voice. And the video is recorded in low-quality settings because of OBS somehow, it should be 1080p but oh well. Best wishes!
@proton46
@proton46 8 ай бұрын
Informativ video as always... You're doing great... Can't wait for the next video!
@Emmanuel-Pangan
@Emmanuel-Pangan 8 ай бұрын
@@proton46 Thanks a lot Proton! I'm wondering if I should do Unity tutorials next... and probably shift this channel to the game development side, any takes on this?
@proton46
@proton46 8 ай бұрын
@@Emmanuel-Pangan I haven't used unity in the last 2 years... but I think shifting over to game development at least for now is a good idea... You can still make videos about more advanced c# features(e.g. delegates and events) as some of these features are probably useful for gamedev as well... :)
@Emmanuel-Pangan
@Emmanuel-Pangan 8 ай бұрын
0:57 The "Before" code is not the same to the original code. Sorry about this.
2D Game Dev Essentials: 5 Must-Know Movement Mechanics
11:00
Red Indie Games
Рет қаралды 9 М.
Incredible: Teacher builds airplane to teach kids behavior! #shorts
00:32
Fabiosa Stories
Рет қаралды 11 МЛН
How do Cats Eat Watermelon? 🍉
00:21
One More
Рет қаралды 11 МЛН
Worst flight ever
00:55
Adam W
Рет қаралды 29 МЛН
Remaking my game from Unity to Godot
3:58
Emmanuel Pangan
Рет қаралды 1,6 М.
React Context API in 3 minutes
3:06
onjsdev
Рет қаралды 831
My Game Design Document (GDD) for my 2D Puzzle-Platformer Game
2:21
How to C# for Beginners (Full Tutorial)
23:12
Emmanuel Pangan
Рет қаралды 81
A neat little trick to debug React applications
2:40
NotGoodProgrammer
Рет қаралды 14
Incredible: Teacher builds airplane to teach kids behavior! #shorts
00:32
Fabiosa Stories
Рет қаралды 11 МЛН