Tagged articles
while-loop
32 articles · Page 1 of 1
This tutorial‑style note walks through Python’s pass statement, the mechanics of while and for loops (including nested loops and common pitfalls), the use of break and continue, and a comprehensive overview of string creation, slicing, case conversion, searching, replacement, and encoding, all illustrated with concrete code examples and expected outputs.
PythonSlicingString Manipulation
0 likes · 23 min read

This article explains step‑by‑step how to use both while‑loops and for‑loops in Python to generate a formatted 9×9 multiplication table, detailing the loop logic, code syntax, and the exact output produced for each row.
LoopsPythonfor loop
0 likes · 10 min read

This tutorial explains how break and continue control loop execution in Python, provides concrete while‑loop examples with their outputs, and demonstrates both for‑ and while‑based nested loops for printing multi‑row patterns, illustrating syntax and behavior step by step.
ContinuePythonbreak
0 likes · 4 min read

This note explains Python's while loop, detailing its three-part structure, special considerations such as the one‑time initial condition, lack of ++/-- operators and do‑while syntax, and provides a concrete example that prints "hello world" ten times.
LoopsPythoncontrol flow
0 likes · 3 min read

While both while(1) and for(;;) create infinite loops in C, this article explains their syntax, execution flow, and demonstrates through compiled assembly that, despite subtle differences, they generate identical machine code, helping developers understand any performance or size implications.
C++assemblycode optimization
0 likes · 5 min read

Python’s else clause, often misunderstood as part of if‑else, actually executes only when a for or while loop completes without encountering a break, offering a concise way to handle search patterns, break detection, and post‑loop actions, but it can confuse developers unfamiliar with this subtle feature.
Code Patternscontrol flowfor loop
0 likes · 7 min read

Learn the three core C++ loop structures—for, while, and do-while—including their syntax, practical examples, control statements like break and continue, plus common pitfalls to avoid for reliable programming.
C++Loopscontrol statements
0 likes · 6 min read

This article introduces Python control flow, explaining conditional statements (if, elif, else) and loop constructs (for, while) with clear syntax, practical examples, tips, and exercises to help readers master decision‑making and iteration in their programs.
Code Examplescontrol flowfor loop
0 likes · 7 min read

This article walks through building a classic number‑guessing game in Python, presenting two community‑sourced solutions, detailed code snippets, explanations of the while‑loop and random modules, and enhancements for input validation and interactive range feedback, helping readers deepen their programming fundamentals.
Number Guessing GamePythoninput validation
0 likes · 6 min read

This guide walks beginners through Python's control flow structures—if statements, for loops, and while loops—explaining their syntax, demonstrating multiple conditional checks, iteration over sequences, and combined usage with clear code examples that illustrate filtering, accumulation, and prime number detection.
control flowfor loopif statement
0 likes · 4 min read

This article explains why loops are needed in programming, introduces Python's for‑in and while loops with practical examples such as summing numbers, generating multiplication tables, guessing games, and solving prime and GCD/LCM problems, and discusses break, continue, and nested loops.
Loopsfor loopfundamentals
0 likes · 9 min read

This article explains the syntax and execution semantics of while(1) and for(;;) in C, compares their generated assembly code, and demonstrates through a practical gcc compilation that both constructs produce identical machine code for an infinite loop.
C++Compilerassembly
0 likes · 7 min read

While(1) and for(;;) both create infinite loops in C, but this article explains their syntactic forms, execution semantics, and demonstrates through compiled assembly that they generate identical machine code, highlighting subtle differences and confirming they are functionally equivalent.
C++assemblyfor loop
0 likes · 5 min read

This article explains the Python 3.8 walrus (assignment) operator, shows how it can reduce code lines in conditional statements, while loops, list comprehensions, and data‑processing blocks, and discusses its readability impact and practical use cases.
assignment expressioncode optimizationlist-comprehension
0 likes · 6 min read

The article explains the origin of Java’s for(;;) infinite loop syntax, compares it with while(true) through source‑code searches and bytecode analysis, and concludes that both constructs compile to identical bytecode, making performance differences negligible while also providing related promotional links.
JDKJavafor loop
0 likes · 5 min read

This article walks through building a classic number‑guessing game in Python, explains two community‑sourced solutions with full source code, highlights common pitfalls, and shows how to enhance interactivity by narrowing the guessing range.
Code ExamplePythonconsole
0 likes · 6 min read

This article explains the syntax and semantics of C's while(1) and for(;;) constructs, compares their execution flow, shows how to compile each to assembly with gcc, and demonstrates that, aside from file names, the generated code is identical under typical settings.
C++GCCassembly
0 likes · 6 min read

This article demonstrates that in Python, plain while and for loops are significantly slower than using built‑in functions like sum or applying a direct mathematical formula, because the former execute extra Python‑level boundary checks and increments, making the latter the most efficient looping alternatives.
Sumbuilt-in functionsfor loop
0 likes · 7 min read

This article examines the origins of Java's infinite loop constructs, compares the frequency of for(;;) and while(true) in the JDK source, and shows through compiled bytecode that both forms are semantically identical and have no inherent performance advantage.
bytecodefor-loopinfinite loop
0 likes · 4 min read

The article explains the historical origin of Java's for(;;) loop, compares it with while(true) in terms of readability and bytecode generation, and shows that both constructs compile to identical bytecode in the standard javac compiler, making performance differences negligible.
JavaLoopsbytecode
0 likes · 4 min read

This article explains the origin of Java’s for(;;) infinite loop syntax, compares it with while(true), shows how both compile to identical bytecode in JDK 8, and concludes that performance differences depend on the JVM implementation rather than the source construct.
JDKJavafor loop
0 likes · 4 min read

This guide demonstrates four practical techniques—input redirection, cat with a pipe, passing the filename as a parameter, and using awk—to read a text file line by line in a Bash script, complete with code snippets and expected output.
File Readingawkbash
0 likes · 4 min read

This article explains Python's while loop syntax, including basic usage, the rarely used while‑else construct, infinite loops, and how break and continue statements affect loop execution, supplemented with clear code examples and a concise summary of loop behavior.
ContinueLoopsbreak
0 likes · 5 min read

This article explains Python's core control‑flow constructs—if‑elif‑else, while, and for loops—providing clear explanations, runnable code examples, and additional notes on boolean logic and string formatting for beginners and intermediate programmers.
Pythoncontrol flowfor loop
0 likes · 4 min read

This guide shows how to use Bash while and until loops to repeatedly run a ping command, pause between attempts, and stop automatically once the network connection succeeds, including a quick trick to repeat the previous command until it succeeds.
bashpingshell
0 likes · 5 min read

The article explains that the infinite loop constructs for(;;) and while(true) in Java originate from C, discusses their syntax and usage, and shows through bytecode inspection that both compile to identical instructions, resulting in no measurable performance gap.
for looplanguage fundamentalswhile-loop
0 likes · 4 min read

This guide explains Python's while loop, covering its basic syntax, condition evaluation, use of continue and break, infinite loops, the optional else clause, and concise one‑line statements, all illustrated with flowcharts, GIFs, and example outputs.
Continuebreakelse clause
0 likes · 4 min read

This article provides a comprehensive guide to Linux shell flow‑control constructs, covering conditional statements (if/elif/else), loops (for, while, until), and selection statements (case, select), complete with syntax explanations, practical examples, and execution results to help readers master shell scripting.
Case statementFlow Controlfor loop
0 likes · 6 min read

This guide demonstrates how to define a Python list, print its contents, and iterate over each element using both a for‑loop and a while‑loop, including step‑by‑step code explanations and common pitfalls such as infinite loops and type conversion.
ListLoopsPython
0 likes · 4 min read

This concise guide explains how Python supports nesting loops, shows the exact syntax for embedding for‑loops inside while‑loops and vice versa, and provides a complete example that prints all prime numbers between 2 and 100, complete with output screenshots.
Prime NumbersPythonfor loop
0 likes · 2 min read

This article explains Python’s while loop syntax, how conditions control execution, the use of continue, break, and else clauses, demonstrates infinite loops, and provides visual flowcharts and code examples to help readers grasp loop control structures effectively.
LoopsPythoncontrol flow
0 likes · 4 min read

This article introduces Python's loop constructs, detailing the differences between for and while loops, how to nest loops, and the use of control statements like break, continue, and pass to manage loop execution flow.
Loopscontrol statementsfor loop
0 likes · 3 min read
