๐ซ Donโt nest "If-else Statements"
Skills:
Algorithm Basics60%
Key Takeaways
Avoids nesting if-else statements using guard clauses in programming
Full Transcript
you are using IF else statements wrong look at this code can you see the problem with using IF else like this in the start car function we are checking two conditions back to back we first check if the seat belt is on then we check if the road is clear if both the conditions are met we start the car if not we do something else and with so many nested statements it's really hard to tell what happens in which condition it's obvious that the readability of this code is really bad how can you fix this well you can use guard claws here flip the condition and check if the seat belt is not on if it's not on write a debug statement in return now check if the road is not clear add a debug statement and return if none of these conditions are met then simply start the car
Original Description
You are using If-Else statements wrong!
.
๐ For more content like this, subscribe to our channel: https://www.youtube.com/PowerCouple26
.
๐ป Follow us on LinkedIn:
โบ โบ https://www.linkedin.com/in/sarrabounouh
โบ โบ https://www.linkedin.com/in/gabag26
.
๐ Stay tuned for future Q&A and AMA sessions: https://www.instagram.com/power_couple26/
๐ TikTok: https://www.tiktok.com/@power_couple26
.
๐ For business inquiries: powercouplejourney@gmail.com
.
.
#shorts #programming #hacks #softwareengineer #technology
Watch on YouTube โ
(saves to browser)
Sign in to unlock AI tutor explanation ยท โก30
Playlist
Uploads from Sahil & Sarra ยท Sahil & Sarra ยท 0 of 60
โ Previous
Next โ
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Product Management Internship - EASIEST Path to Become a PM
Sahil & Sarra
I Quit $200,000 Software Engineer Job at Amazon
Sahil & Sarra
What do I do as a Product Manager? - Product Manager Role
Sahil & Sarra
CHEAT SHEET that I Used to Crack Product Manager Interview at MICROSOFT
Sahil & Sarra
Why Tech Workers are Getting RICH๐ฐ๐ฐ #shorts
Sahil & Sarra
Why Is Everyone Quitting Their Six Figure Tech Job?
Sahil & Sarra
5 Years of Coding - Everything I've Learned
Sahil & Sarra
5 Highest Paying Tech Companies ๐ธ๐ธ #shorts
Sahil & Sarra
How I TRIPLED My Salary by Joining TECH
Sahil & Sarra
How I Became a Software Engineer Without a Computer Science Degree
Sahil & Sarra
Top 5 non-CODING Tech Jobs that Pay $100,000+
Sahil & Sarra
Top 5 Tech Jobs That Pay $100,000+ Without Coding
Sahil & Sarra
FASTEST Way to Learn Coding and ACTUALLY Get a Job
Sahil & Sarra
Coding Interviews Are Easier Than You Think
Sahil & Sarra
THIS is Why Software Engineers Make So Much Money
Sahil & Sarra
System Design Interviews are a SCAM
Sahil & Sarra
I got $50,000 more when I negotiated my tech salary
Sahil & Sarra
How I would learn to code in (If I could start over)
Sahil & Sarra
Google is not the best tech company
Sahil & Sarra
How YouTube is killing your programming career
Sahil & Sarra
This is Why Your Resume Gets Rejected
Sahil & Sarra
How I Hacked My Mind To Learn Coding
Sahil & Sarra
FASTEST Way to Learn Data Science and ACTUALLY Get a Job
Sahil & Sarra
FASTEST Way to Learn Web Development and ACTUALLY Get a Job
Sahil & Sarra
Why Most People FAIL to Learn Coding
Sahil & Sarra
Google Engineer reveals his darkest secrets
Sahil & Sarra
Become a better Programmer in 8 minutes
Sahil & Sarra
Start Behaving Like a Programmer
Sahil & Sarra
The Resume That Got Me Into Google
Sahil & Sarra
I solved 541 Leetcode problems. But you need only 150.
Sahil & Sarra
Why Good Programmers FAIL Coding Interviews
Sahil & Sarra
Can you solve this problem in one line?
Sahil & Sarra
Puzzles for Software Engineers - Microsoft #1
Sahil & Sarra
Puzzles for Software Engineers - Amazon #1
Sahil & Sarra
Layoffs = The END of Software Engineering?
Sahil & Sarra
Puzzles for Software Engineers - Apple #1
Sahil & Sarra
Puzzles for Software Engineers - Amazon #2
Sahil & Sarra
Puzzles for Software Engineers - Microsoft #2
Sahil & Sarra
Puzzles for Software Engineers - Apple #2
Sahil & Sarra
2-Minute Rule to Learn Coding - Atomic Habits
Sahil & Sarra
2 Minute Rule for Coding
Sahil & Sarra
5 Math Skills Every Programmer Needs
Sahil & Sarra
3 Developer Roadmaps That Actually Work
Sahil & Sarra
Cracked Google without a CS degree
Sahil & Sarra
Top 5 Coding Languages To Get a Job
Sahil & Sarra
4 Reasons Good Programmers FAIL Coding Interviews
Sahil & Sarra
Reality of Software Development
Sahil & Sarra
C is the grandmother of JavaScript
Sahil & Sarra
How to Hack Passwords
Sahil & Sarra
Learn Python with ChatGPT
Sahil & Sarra
Learn Web Development with ChatGPT
Sahil & Sarra
ChatGPT 2.0 aka GPT-4 is here!
Sahil & Sarra
7 things I wish I knew in my 20s
Sahil & Sarra
๐ธ๐ธ $177,000,000 Coding Error
Sahil & Sarra
5 Google Search Secrets
Sahil & Sarra
QWERTY Keyboard Slows Your Typing ๐ค
Sahil & Sarra
๐ฐ๐ฐ Top 5 Highest Paying Jobs For Programmers
Sahil & Sarra
๐ฉ๐ปโ๐ป Top 5 Programming Languages
Sahil & Sarra
5 Steps to become a Full-Time Developer
Sahil & Sarra
Coding is NOT enough
Sahil & Sarra
More on: Algorithm Basics
View skill โRelated Reads
๐ฐ
๐ฐ
๐ฐ
๐ฐ
Oracle Just Fired 30,000 People to Pay One Customerโs AI Bill
Medium ยท AI
Anthropic's Landmark $1.5B Copyright Settlement Approved
Dev.to AI
Indiaโs IT Sector Sees AI Hiring Surge Amid Broader Recruitment Slowdown
Dev.to AI
Anthropicโs landmark $1.5B copyright settlement is approved
TechCrunch AI
๐
Tutor Explanation
DeepCamp AI