Pages

Topics

Tools

↑↓navigate↵openescclose

All syntax guides

Short, practical guides on programming syntax, language fundamentals, and the tools developers reach for every day.

3,980 guides across 14 topics

Topics

Latest guides

A Java code snippet showing a loop with break and continue statements, illustrating the difference in control flow.
Java

Java break vs continue: Controlling Loop Execution

Java break vs continue: Learn how break and continue control loop flow in Java, with syntax examples, labeled variants, and guidance on choosing the right statement.

Java control flowbreak statementcontinue statementJava loops
Diagram showing a Java loop where one iteration branches off and skips ahead to the next cycle, illustrating the continue statement.
Java

Java Continue Statement: Loop Control Explained

Understand how the Java continue statement works in for, while, and do-while loops, including labeled continue for nested loops, edge cases, and maintainability tradeoffs.

java loopscontrol flowlabeled continuebreak vs continue
Diagram illustrating a Java break statement exiting a loop with a clear exit arrow
Java

Java Break Statement: Control Flow Explained

Understand how the Java break statement works in loops and switch statements, including labeled breaks, common pitfalls, and alternatives.

Javacontrol flowloopsswitch
Diagram of nested for loops showing outer loop controlling inner loop iterations
Java

Java Nested For Loop Explained with Examples

Understand Java nested for loops: syntax and execution order, common use cases, performance costs, pitfalls to avoid, and alternatives.

nested loopsJava loopsloop performancetime complexity
Comparison of Java traditional for loop and enhanced for loop syntax and usage
Java

Java For vs Enhanced For: Choosing the Right Loop

Compare Java's traditional for loop with the enhanced for loop: syntax, use cases, performance, and how to choose between them.

Javafor loopenhanced foriteration
Diagram showing a Java foreach loop iterating over a collection with an iterator symbol
Java

Java Foreach Loop: Syntax, Behavior, and Limitations

java foreach loop: Understand the Java foreach loop: its syntax, how it compiles to iterators, common pitfalls, and when to choose it over indexed loops.

enhanced for loopiterationcollectionsarrays
Diagram showing a Java enhanced for loop iterating over a collection with a highlighted loop variable.
Java

Java Enhanced For Loop: Syntax, Behavior, and Limits

How Java's enhanced for loop behaves for arrays and Iterables, where its limitations matter, and when a classic for loop or stream is a better fit.

Java loopsfor-eachIterableJava collections
Side-by-side diagram comparing while and do-while loop condition evaluation order in Java
Java

Java While vs Do While: Key Differences

java while vs do while: Compare Java's while and do-while loops: how condition timing differs, when each is appropriate, and common mistakes to avoid.

Java loopswhile loopdo-while loopcontrol flow
A visual comparison of Java for and while loop syntax, showing the loop header and condition placement.
Java

Java For vs While: Which Loop Fits Your Code

Compare Java's for and while loops: syntax, control flow, performance, readability, and when each loop fits best in real code.

Java loopsfor loopwhile looploop control
Illustration of a Java do-while loop showing the body executing at least once before the condition check.
Java

Java Do While Loop: Syntax and Usage

Learn the Java do-while loop: syntax, how it differs from while, and when at-least-once execution makes it the right choice.

do-whileJava loopscontrol flowwhile loop