Control Flow in C++ (continue, break, return)

41
54



Twitter ►
Instagram ►
Patreon ►

Loops in C++ ►

Today we’re talking about control flow statements in C++. Control flow statements allow us to change the “flow” of our program so that we can change what it does under certain circumstances. This is another one of those really important fundamentals that you’ll want to make sure you understand really well.

Number one strategy to learn this? Start writing some code and see what these statements do! Additionally, step through the code line-by-line using the debugger if you’re still confused about what actually happens.

Series Playlist ►

BEST laptop for programming! ►
My FAVOURITE keyboard for programming! ►
FAVOURITE monitors for programming! ►

MAIN Camera ►
MAIN Lens ►
Microphone ►

Slack ►
Stream ►
Website ►
Facebook ►

Nguồn:https://quydinh.com/

41 COMMENTS

  1. the videos are great, I start understanding more. However, please consider not to put background music for non-native speakers. It is very distracting.

  2. Using " return " in some type of nested function would have made it more clear, using it in main() threw me for a moment.
    —-
    Regarding your comment about return as a normal line of its own creating dead code and compilers removing it; was the comment in regard to this specific case or more general? Because I can imagine some instruction earlier in the code that has some sort of jump or goto line X, with X being the line just after the return statement.

  3. "So return […] can be absolutely anywhere in your code." Is this accurate? do you mean anywhere inside a function? Pretty sure putting return in global space or in a class declaration wouldn't make much sense…

  4. A bit off topic but I'm happy at how much the quality of programming tutorials have raised. I remember when I first started teaching myself most tutorials were people with heavy accents and bad mics trying to explain something but you had to raise the quality to 360p and squint to see the code.

  5. What about goto statements? Yes I know there's a hot debate on whether to use them in C++ but I find it very useful in special cases. It's better if the beginner knows it exists in the off-chance they might need it.

LEAVE A REPLY

Please enter your comment!
Please enter your name here