Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

Break and Continue in Go

Gary Clarke via YouTube

Overview

Coursera Flash Sale
40% Off Coursera Plus for 3 Months!
Grab it
Learn how to control loop execution in Go using the break and continue keywords in this 36-minute tutorial. Master the fundamental concepts of exiting loops early with break, which stops a loop completely and continues execution after the loop, and skipping iterations with continue, which bypasses the rest of the current iteration and moves to the next one. Discover when to use break versus continue, understand how both keywords function across all forms of for loops, and explore how they help reduce nested if statements while making your code's intent clearer. Gain practical experience through conceptual explanations that demonstrate how break is ideal for stopping loops entirely when you find what you're looking for, while continue is perfect for skipping certain values while keeping the loop running. Build upon your existing knowledge of for loops by adding fine-grained control over loop execution, enabling you to write more precise and readable looping logic without deeply nested conditional statements. Practice with the included challenge exercise and access the lesson folder on GitHub to reinforce your understanding of these essential Go control flow keywords.

Syllabus

Break and Continue in Go

Taught by

Gary Clarke

Reviews

Start your review of Break and Continue in Go

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.