<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>forloop Archives - scmGalaxy</title>
	<atom:link href="https://www.scmgalaxy.com/tutorials/tag/forloop/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.scmgalaxy.com/tutorials/tag/forloop/</link>
	<description>A Platform for Software Engineers</description>
	<lastBuildDate>Sat, 21 Feb 2026 07:13:27 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1</generator>
	<item>
		<title>Mastering the For Loop: Concepts, Use Cases, Workflow, and Getting Started</title>
		<link>https://www.scmgalaxy.com/tutorials/mastering-the-for-loop-concepts-use-cases-workflow-and-getting-started/</link>
					<comments>https://www.scmgalaxy.com/tutorials/mastering-the-for-loop-concepts-use-cases-workflow-and-getting-started/#respond</comments>
		
		<dc:creator><![CDATA[Vijay K]]></dc:creator>
		<pubDate>Fri, 16 May 2025 06:44:00 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[ControlStructures]]></category>
		<category><![CDATA[CProgramming]]></category>
		<category><![CDATA[forloop]]></category>
		<category><![CDATA[loops]]></category>
		<category><![CDATA[ProgrammingBasics]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[SoftwareDevelopment]]></category>
		<category><![CDATA[TechTutorial]]></category>
		<guid isPermaLink="false">https://www.scmgalaxy.com/tutorials/?p=12328</guid>

					<description><![CDATA[<p>What is a For Loop? A for loop is a fundamental control structure in programming languages used to repeat a [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/mastering-the-for-loop-concepts-use-cases-workflow-and-getting-started/">Mastering the For Loop: Concepts, Use Cases, Workflow, and Getting Started</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="1024" height="683" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/05/image-54-1024x683.png" alt="" class="wp-image-12331" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/05/image-54-1024x683.png 1024w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/05/image-54-300x200.png 300w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/05/image-54-768x512.png 768w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/05/image-54.png 1536w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<h3 class="wp-block-heading"><strong>What is a For Loop?</strong></h3>



<p class="wp-block-paragraph">A <strong>for loop</strong> is a fundamental control structure in programming languages used to repeat a block of code a specified number of times or over a sequence. It provides a concise way to iterate through data structures such as arrays, lists, or ranges, allowing developers to automate repetitive tasks efficiently.</p>



<p class="wp-block-paragraph">The basic idea of a for loop is to execute the same set of instructions repeatedly while updating a loop counter or iterating over elements until a termination condition is met.</p>



<p class="wp-block-paragraph">For loops exist in almost all programming languages, with syntax variations depending on the language. Despite syntactic differences, the concept remains consistent: repeat a block of code with controlled iteration.</p>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 class="wp-block-heading"><strong>What Are the Major Use Cases of For Loop?</strong></h3>



<p class="wp-block-paragraph">For loops are indispensable in programming and appear in numerous contexts, including but not limited to:</p>



<h4 class="wp-block-heading">1. <strong>Iterating Over Collections and Arrays</strong></h4>



<ul class="wp-block-list">
<li>Process every element in a list, array, or collection.</li>



<li>Example: Calculating the sum of an array of numbers, printing all items in a list.</li>
</ul>



<h4 class="wp-block-heading">2. <strong>Repetitive Task Automation</strong></h4>



<ul class="wp-block-list">
<li>Execute a task multiple times without code duplication.</li>



<li>Example: Printing a message ten times, running simulations repeatedly.</li>
</ul>



<h4 class="wp-block-heading">3. <strong>Index-based Access</strong></h4>



<ul class="wp-block-list">
<li>Access elements of an array or string using an index.</li>



<li>Example: Modifying array elements at specific positions.</li>
</ul>



<h4 class="wp-block-heading">4. <strong>Nested Iterations</strong></h4>



<ul class="wp-block-list">
<li>Use nested for loops to traverse multidimensional data structures like matrices or grids.</li>



<li>Example: Processing pixels in an image, generating multiplication tables.</li>
</ul>



<h4 class="wp-block-heading">5. <strong>Controlling Program Flow</strong></h4>



<ul class="wp-block-list">
<li>For loops combined with conditional statements enable complex decision-making over sequences.</li>



<li>Example: Filtering data or searching for specific elements.</li>
</ul>



<h4 class="wp-block-heading">6. <strong>Generating Sequences</strong></h4>



<ul class="wp-block-list">
<li>Create sequences of numbers or strings programmatically.</li>



<li>Example: Generating timestamps, numbering items in reports.</li>
</ul>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="630" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/05/image-55-1024x630.png" alt="" class="wp-image-12332" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/05/image-55-1024x630.png 1024w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/05/image-55-300x185.png 300w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/05/image-55-768x473.png 768w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/05/image-55-1536x945.png 1536w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/05/image-55.png 1794w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 class="wp-block-heading"><strong>How For Loop Works Along with Architecture</strong></h3>



<p class="wp-block-paragraph">Though a for loop is a high-level programming construct, understanding how it works under the hood clarifies its efficiency and limitations.</p>



<h4 class="wp-block-heading"><strong>Basic Execution Architecture of a For Loop</strong></h4>



<ol class="wp-block-list">
<li><strong>Initialization</strong>
<ul class="wp-block-list">
<li>The loop counter or iterator variable is initialized to a starting value.</li>
</ul>
</li>



<li><strong>Condition Check</strong>
<ul class="wp-block-list">
<li>Before each iteration, the loop checks a termination condition.</li>



<li>If the condition is true, the loop body executes; if false, the loop exits.</li>
</ul>
</li>



<li><strong>Execution of Loop Body</strong>
<ul class="wp-block-list">
<li>The statements inside the loop block run for the current iteration.</li>
</ul>
</li>



<li><strong>Increment/Update</strong>
<ul class="wp-block-list">
<li>After the loop body executes, the iterator or loop counter updates (e.g., incremented by 1).</li>
</ul>
</li>



<li><strong>Repeat or Exit</strong>
<ul class="wp-block-list">
<li>Steps 2-4 repeat until the termination condition fails.</li>
</ul>
</li>
</ol>



<h4 class="wp-block-heading"><strong>Machine-Level Perspective</strong></h4>



<ul class="wp-block-list">
<li>When compiled, the for loop translates into a combination of jump (branch) and comparison instructions.</li>



<li>The CPU executes these instructions in sequence, enabling repeated execution without reloading the program.</li>



<li>Loop efficiency depends on the compiler’s optimization and processor architecture features like pipelining and branch prediction.</li>
</ul>



<h4 class="wp-block-heading"><strong>For Loop in Different Programming Paradigms</strong></h4>



<ul class="wp-block-list">
<li><strong>Imperative Languages (e.g., C, Java, Python)</strong>: For loops are explicit, controlling iteration with initialization, condition, and update.</li>



<li><strong>Functional Programming</strong>: Iteration is often done using recursion or higher-order functions instead of explicit loops.</li>



<li><strong>Scripting Languages</strong>: For loops are often used to iterate over collections or ranges, sometimes with syntactic sugar for readability.</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 class="wp-block-heading"><strong>What Are the Basic Workflows of For Loop?</strong></h3>



<p class="wp-block-paragraph">The typical workflow of a for loop involves these steps:</p>



<ol class="wp-block-list">
<li><strong>Setup the Loop Parameters</strong>
<ul class="wp-block-list">
<li>Define the starting point, ending condition, and the update expression.</li>
</ul>
</li>



<li><strong>Initialize Loop Counter</strong>
<ul class="wp-block-list">
<li>Assign the loop control variable its initial value.</li>
</ul>
</li>



<li><strong>Check Loop Condition</strong>
<ul class="wp-block-list">
<li>Evaluate whether the loop should continue.</li>
</ul>
</li>



<li><strong>Execute Loop Body</strong>
<ul class="wp-block-list">
<li>Run the code block for the current iteration.</li>
</ul>
</li>



<li><strong>Update Loop Counter</strong>
<ul class="wp-block-list">
<li>Modify the loop variable (increment, decrement, or more complex updates).</li>
</ul>
</li>



<li><strong>Repeat or Exit</strong>
<ul class="wp-block-list">
<li>Repeat steps 3-5 until the condition becomes false.</li>
</ul>
</li>
</ol>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 class="wp-block-heading"><strong>Step-by-Step Getting Started Guide for For Loop</strong></h3>



<p class="wp-block-paragraph">If you’re new to programming or want to solidify your understanding of for loops, follow this guide:</p>



<h4 class="wp-block-heading"><strong>Step 1: Understand the Syntax</strong></h4>



<ul class="wp-block-list">
<li><strong>Python Example:</strong> <code>for i in range(5): print(i)</code></li>



<li><strong>C Example:</strong> <code>for (int i = 0; i &lt; 5; i++) { printf("%dn", i); }</code></li>
</ul>



<h4 class="wp-block-heading"><strong>Step 2: Write Your First Simple Loop</strong></h4>



<ul class="wp-block-list">
<li>Loop through numbers 0 to 4 and print them.</li>



<li>Experiment by changing the range or loop limits.</li>
</ul>



<h4 class="wp-block-heading"><strong>Step 3: Iterate Over Collections</strong></h4>



<ul class="wp-block-list">
<li>Example with Python list: <code>fruits = ['apple', 'banana', 'cherry'] for fruit in fruits: print(fruit)</code></li>
</ul>



<h4 class="wp-block-heading"><strong>Step 4: Use Loop Counters for Indexing</strong></h4>



<ul class="wp-block-list">
<li>Access elements by index, e.g., modify elements: <code>numbers = [10, 20, 30, 40] for i in range(len(numbers)): numbers[i] += 5 print(numbers)</code></li>
</ul>



<h4 class="wp-block-heading"><strong>Step 5: Use Nested For Loops</strong></h4>



<ul class="wp-block-list">
<li>Example: Print multiplication table: <code>for i in range(1, 4): for j in range(1, 4): print(f"{i} x {j} = {i*j}")</code></li>
</ul>



<h4 class="wp-block-heading"><strong>Step 6: Add Conditional Logic Inside Loops</strong></h4>



<ul class="wp-block-list">
<li>Use if statements to filter data: <code>for num in range(10): if num % 2 == 0: print(f"{num} is even")</code></li>
</ul>



<h4 class="wp-block-heading"><strong>Step 7: Avoid Infinite Loops</strong></h4>



<ul class="wp-block-list">
<li>Ensure your termination condition will eventually be false.</li>



<li>In languages like C, forgetting to increment can cause infinite loops.</li>
</ul>



<h4 class="wp-block-heading"><strong>Step 8: Experiment and Practice</strong></h4>



<ul class="wp-block-list">
<li>Try different loop ranges, steps, and iterables.</li>



<li>Combine with other control structures for more complex programs.</li>
</ul>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/mastering-the-for-loop-concepts-use-cases-workflow-and-getting-started/">Mastering the For Loop: Concepts, Use Cases, Workflow, and Getting Started</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/mastering-the-for-loop-concepts-use-cases-workflow-and-getting-started/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Understanding Loops: Use Cases, Workflow, and Getting Started Guide</title>
		<link>https://www.scmgalaxy.com/tutorials/understanding-loops-use-cases-workflow-and-getting-started-guide/</link>
					<comments>https://www.scmgalaxy.com/tutorials/understanding-loops-use-cases-workflow-and-getting-started-guide/#respond</comments>
		
		<dc:creator><![CDATA[Vijay K]]></dc:creator>
		<pubDate>Tue, 13 May 2025 07:36:36 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CodingFundamentals]]></category>
		<category><![CDATA[forloop]]></category>
		<category><![CDATA[loops]]></category>
		<category><![CDATA[ProgrammingBasics]]></category>
		<category><![CDATA[whileloop]]></category>
		<guid isPermaLink="false">https://www.scmgalaxy.com/tutorials/?p=12294</guid>

					<description><![CDATA[<p>What is a Loop? In the context of programming, a loop is a fundamental concept used to repeat a block [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/understanding-loops-use-cases-workflow-and-getting-started-guide/">Understanding Loops: Use Cases, Workflow, and Getting Started Guide</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="683" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/05/257f1a2e-3eca-4351-a298-2ec0239ea2c2-1024x683.png" alt="" class="wp-image-12297" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/05/257f1a2e-3eca-4351-a298-2ec0239ea2c2-1024x683.png 1024w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/05/257f1a2e-3eca-4351-a298-2ec0239ea2c2-300x200.png 300w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/05/257f1a2e-3eca-4351-a298-2ec0239ea2c2-768x512.png 768w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/05/257f1a2e-3eca-4351-a298-2ec0239ea2c2.png 1536w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h4 class="wp-block-heading">What is a Loop?</h4>



<p class="wp-block-paragraph">In the context of programming, a loop is a fundamental concept used to repeat a block of code multiple times until a specific condition is met. Loops are essential in automating repetitive tasks and controlling program flow. They are found in almost every programming language and are used to execute instructions over and over, with each iteration executing the same set of commands or slightly altered values based on logic.</p>



<p class="wp-block-paragraph">Loops can be divided into different types based on their behavior and use cases. The most common types include:</p>



<ul class="wp-block-list">
<li><strong>For Loop:</strong> Repeats a block of code for a specific number of times, based on a known range or sequence.</li>



<li><strong>While Loop:</strong> Repeats the block of code as long as a specified condition is true.</li>



<li><strong>Do-While Loop:</strong> Similar to the while loop but ensures that the block of code runs at least once, since the condition is checked after execution.</li>
</ul>



<p class="wp-block-paragraph">Loops are essential for tasks such as iterating through data structures (like arrays and lists), managing repetitive calculations, and handling user inputs.</p>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h4 class="wp-block-heading">Major Use Cases of Loops</h4>



<p class="wp-block-paragraph">Loops are used in various scenarios across different fields of software development. Below are some major use cases:</p>



<ol class="wp-block-list">
<li><strong>Data Processing:</strong> Loops are commonly used to iterate over datasets or collections (e.g., lists, arrays) for processing each element. This includes applying transformations, calculations, or extracting information from each item.
<ul class="wp-block-list">
<li>Example: Looping through a list of numbers to find their sum or average.</li>
</ul>
</li>



<li><strong>Automation of Repetitive Tasks:</strong> Whenever a task needs to be repeated a set number of times or until a certain condition is met, loops come in handy.
<ul class="wp-block-list">
<li>Example: Automating the process of filling in forms repeatedly or generating reports every month.</li>
</ul>
</li>



<li><strong>Handling User Input:</strong> In many programs, loops wait for the user to enter valid data. The loop keeps asking the user for input until the correct format is entered or a termination condition is met.
<ul class="wp-block-list">
<li>Example: Asking for a password until the correct one is provided.</li>
</ul>
</li>



<li><strong>Games and Simulations:</strong> Loops are used to manage game loops or simulations where a series of actions must be repeated many times per second.
<ul class="wp-block-list">
<li>Example: The main game loop runs continuously to update game state, process user actions, and render frames.</li>
</ul>
</li>



<li><strong>Search Algorithms:</strong> Loops are used to traverse lists, arrays, or databases, checking each item for a specific condition (e.g., searching for a value).
<ul class="wp-block-list">
<li>Example: Linear search, where each element of an array is checked to find a specific item.</li>
</ul>
</li>
</ol>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h4 class="wp-block-heading">How Loops Work Along with Architecture</h4>



<p class="wp-block-paragraph">The architecture of loops can be broken down into the following core components:</p>



<ol class="wp-block-list">
<li><strong>Initialization:</strong> This is where the loop begins. Initializing a loop typically involves setting the starting point for counters or variables. For example, initializing a variable for a for loop (e.g., <code>int i = 0</code>).</li>



<li><strong>Condition:</strong> This condition is checked before each iteration (in the case of <code>while</code> or <code>for</code> loops) to determine if the loop should continue. The condition evaluates to <code>true</code> or <code>false</code> and is the key factor that controls the number of iterations.</li>



<li><strong>Execution of Code Block:</strong> This is the part of the loop where the instructions are executed. Each time the loop runs, the block of code within the loop is processed.</li>



<li><strong>Iteration (or Update):</strong> This is where the loop&#8217;s controlling variables are updated. For example, in a <code>for</code> loop, the counter variable (<code>i++</code>) is incremented or changed at the end of each iteration.</li>



<li><strong>Termination:</strong> When the condition no longer holds true (i.e., the loop&#8217;s exit condition is met), the loop terminates, and control is passed to the next instruction after the loop.</li>
</ol>



<p class="wp-block-paragraph">Here’s a simple example using a <strong>for loop</strong>:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
for i in range(1, 6):  # Initialization: i starts from 1, condition is i &amp;lt; 6
    print(i)  # Execution: Print the current value of i
    # Iteration: i will increment by 1 after each loop

</pre></div>


<p class="wp-block-paragraph"><strong>Flow of Execution:</strong></p>



<ol class="wp-block-list">
<li>Initialize <code>i = 1</code>.</li>



<li>Check if <code>i &lt; 6</code> (condition).</li>



<li>Print the value of <code>i</code>.</li>



<li>Increment <code>i</code> (update step).</li>



<li>Repeat until <code>i</code> becomes 6, which breaks the loop.</li>
</ol>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h4 class="wp-block-heading">Basic Workflow of Loops</h4>



<p class="wp-block-paragraph">The basic workflow of loops generally follows these steps:</p>



<ol class="wp-block-list">
<li><strong>Setup:</strong> Define the loop variables and the condition for the loop (e.g., a counter variable and a limit).</li>



<li><strong>Condition Check:</strong> The loop starts by checking the condition, which determines if the loop should run.</li>



<li><strong>Execution Block:</strong> If the condition is true, the body of the loop executes. This block can contain multiple instructions.</li>



<li><strong>Update Step:</strong> Update the loop&#8217;s controlling variables (e.g., increment a counter).</li>



<li><strong>Exit Condition:</strong> When the condition fails (i.e., becomes false), the loop ends, and control moves to the next block of code outside the loop.</li>
</ol>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h4 class="wp-block-heading">Step-by-Step Getting Started Guide for Loops</h4>



<p class="wp-block-paragraph">Here’s a simple guide to get started with loops in any programming language:</p>



<ol class="wp-block-list">
<li><strong>Choose Your Language:</strong> Start by choosing a programming language where you will implement loops. Popular languages like Python, JavaScript, and Java all have built-in support for loops.</li>



<li><strong>Understand the Syntax:</strong> Learn the basic syntax for loops in your chosen language. For example, in Python, a <code>for</code> loop looks like: <code>for i in range(5): # i will range from 0 to 4 print(i)</code></li>



<li><strong>Define the Loop Variables:</strong> Decide on the variable that will control the loop. This could be a counter or an index used to track the iterations.</li>



<li><strong>Set the Condition:</strong> Determine the condition under which the loop should continue. This could be checking if a counter is less than a certain number or if a certain value has been reached.</li>



<li><strong>Write the Loop Body:</strong> Within the loop, write the code you want to execute repeatedly. This could be calculations, data processing, or user interaction.</li>



<li><strong>Test Your Loop:</strong> Run the code and check if it performs as expected. Ensure that the loop exits at the right time.</li>



<li><strong>Iterate and Improve:</strong> After you get a basic loop working, try using different loop structures or enhancing your logic with more complex conditions or actions inside the loop.</li>
</ol>



<h3 class="wp-block-heading"></h3>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/understanding-loops-use-cases-workflow-and-getting-started-guide/">Understanding Loops: Use Cases, Workflow, and Getting Started Guide</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/understanding-loops-use-cases-workflow-and-getting-started-guide/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How does a For loop work in JavaScript</title>
		<link>https://www.scmgalaxy.com/tutorials/how-does-a-for-loop-work-in-javascript/</link>
					<comments>https://www.scmgalaxy.com/tutorials/how-does-a-for-loop-work-in-javascript/#respond</comments>
		
		<dc:creator><![CDATA[rajeshkumar]]></dc:creator>
		<pubDate>Wed, 28 Jul 2021 13:03:52 +0000</pubDate>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[forloop]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[loop]]></category>
		<category><![CDATA[whileloop]]></category>
		<guid isPermaLink="false">https://www.scmgalaxy.com/tutorials/?p=7157</guid>

					<description><![CDATA[<p>For Loop The for loop is frequently used, usually where the loop will be traversed a fixed number of times. [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/how-does-a-for-loop-work-in-javascript/">How does a For loop work in JavaScript</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">For Loop</h2>



<p class="wp-block-paragraph">The for loop is frequently used, usually where the loop will be traversed a fixed number of times.</p>



<p class="wp-block-paragraph">Syntax:</p>



<script src="https://gist.github.com/vijaypk376/69b9965460e2d8a144cd564db9966621.js"></script>



<script src="https://gist.github.com/vijaypk376/f015458db446c5fd02e4a082ffe2456d.js"></script>



<script src="https://gist.github.com/vijaypk376/e774ee0d3b3980b2520487d763d7f5ec.js"></script>



<script src="https://gist.github.com/vijaypk376/3f7a54f14f54690adc3a6cc3197f9253.js"></script>



<script src="https://gist.github.com/vijaypk376/9caac63f311795b6ce99d83e4c3f0be0.js"></script>



<h2 class="wp-block-heading">Nested For Loop</h2>



<p class="wp-block-paragraph">For loop inside for loop</p>



<p class="wp-block-paragraph">Syntax:</p>



<script src="https://gist.github.com/vijaypk376/cfbcdc4f2717c023c91ad63e43260ac5.js"></script>



<script src="https://gist.github.com/vijaypk376/d7b33f9aba48ec93b88f058e8f2a7273.js"></script>



<h2 class="wp-block-heading">While loop</h2>



<p class="wp-block-paragraph">The while loop keeps repeating an action until an associated condition returns false.</p>



<p class="wp-block-paragraph">Syntax:</p>



<script src="https://gist.github.com/vijaypk376/fd5b7d182fe9604f3ee2c56325c611b8.js"></script>



<script src="https://gist.github.com/vijaypk376/40273e1ef8079051fdbff0169300e8af.js"></script>



<script src="https://gist.github.com/vijaypk376/994fe6476fbeac9f11ed581c4f9baf4e.js"></script>



<h2 class="wp-block-heading">Nested While loop</h2>



<p class="wp-block-paragraph">While Loop inside While Loop</p>



<script src="https://gist.github.com/vijaypk376/71ce33b064c554b24978dcef20bc5883.js"></script>



<h2 class="wp-block-heading">Do While Loop</h2>



<p class="wp-block-paragraph">The do while loop is similar to while loop, but the condition is checked after the loop body is executed. This ensures that the loop body is run at least once.</p>



<p class="wp-block-paragraph">Syntax :</p>



<script src="https://gist.github.com/vijaypk376/575e46fc671933022a493f813b8cacbc.js"></script>



<script src="https://gist.github.com/vijaypk376/20dbabe1c8e4d8784f3f07f6565d0af4.js"></script>



<script src="https://gist.github.com/vijaypk376/811a2671036b376e6f42f9b7e5933f9a.js"></script>



<h2 class="wp-block-heading">Nested Do While Loop</h2>



<p class="wp-block-paragraph">Do while inside Do while</p>



<script src="https://gist.github.com/vijaypk376/d877ee362da8b323ec7e283604c0e991.js"></script>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/how-does-a-for-loop-work-in-javascript/">How does a For loop work in JavaScript</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/how-does-a-for-loop-work-in-javascript/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Define What is Loop and what are the Types with Syntax.</title>
		<link>https://www.scmgalaxy.com/tutorials/define-what-is-loop-and-what-are-the-types-with-syntax/</link>
					<comments>https://www.scmgalaxy.com/tutorials/define-what-is-loop-and-what-are-the-types-with-syntax/#respond</comments>
		
		<dc:creator><![CDATA[rajeshkumar]]></dc:creator>
		<pubDate>Mon, 28 Jun 2021 12:36:38 +0000</pubDate>
				<category><![CDATA[php]]></category>
		<category><![CDATA[forloop]]></category>
		<category><![CDATA[loop]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[php framework]]></category>
		<category><![CDATA[whileloop]]></category>
		<guid isPermaLink="false">https://www.scmgalaxy.com/tutorials/?p=6574</guid>

					<description><![CDATA[<p>In this tutorial i’m going to define what is loop and what are the types with syntax with examples. What [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/define-what-is-loop-and-what-are-the-types-with-syntax/">Define What is Loop and what are the Types with Syntax.</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph" id="41cb">In this tutorial i’m going to define what is loop and what are the types with syntax with examples.</p>



<p class="wp-block-paragraph" id="9608"><strong>What is Loop?</strong></p>



<p class="wp-block-paragraph" id="f1ae">Any Repeated task more than one time that is called Loop. In a loop structure, the loop asks a question. If the answer requires action, it is executed. Using loops in computer programs simplifies rather optimizes the process of coding.</p>



<p class="wp-block-paragraph" id="78db">Types of Loops?</p>



<ol class="wp-block-list"><li>While Loop.</li><li>Do while Loop</li><li>For Loop</li></ol>



<p class="wp-block-paragraph" id="7e26">While Loop:- While loop is a pre-test loop. It first test a specified conditional expression and as long as the condition true action taken. While loop also known as Entry Control Loop</p>



<p class="wp-block-paragraph" id="7ca1">Syntax with example:-</p>



<pre class="wp-block-preformatted">&lt;?php<br><br>$am =1;<br><br>while($am&lt;=6;<br>    {<br>        echo "this is while condition: $am &lt;br /&gt;";<br>        $am++;<br>    }<br>?&gt;</pre>



<p class="wp-block-paragraph" id="ddd7">OutPut <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f447.png" alt="👇" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<figure class="wp-block-image"><img decoding="async" src="https://miro.medium.com/max/591/1*s9hlSfFyyUWBs7wmYP7y1w.png" alt=""/></figure>



<p class="wp-block-paragraph" id="47f1">2. Do while Loop:- Do while loop is similar to while loop but the condition is checked after the loop. This ensure that the loop body is run at least once.</p>



<pre class="wp-block-preformatted">&lt;?php<br><br>$ami = 3;<br><br>    do{<br>        echo "this is Laravel Amit: $ami &lt;br /&gt;";<br>        $ami++;<br><br>    }while($ami&lt;=6);<br><br>?&gt;</pre>



<p class="wp-block-paragraph" id="6a3c">OutPut <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f447.png" alt="👇" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<figure class="wp-block-image"><img decoding="async" src="https://miro.medium.com/proxy/1*gjsl1By1EwueW-U_S9rZmQ.png" alt=""/></figure>



<p class="wp-block-paragraph" id="d488">3. For Loop :- The for is frequently used usullay where the loop will be traversed a fixed numbers of times. A loop variable is used to control the loop</p>



<p class="wp-block-paragraph" id="a98b">Syntax + example:-</p>



<pre class="wp-block-preformatted">&lt;?php<br><br>   for($num=1; $num&lt;=5; $num++)<br>   {<br>       echo "this is for loop: $num &lt;br /&gt;";<br>   }<br><br>?&gt;</pre>



<p class="wp-block-paragraph" id="c66b">OutPut <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f447.png" alt="👇" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<figure class="wp-block-image"><img decoding="async" src="https://miro.medium.com/max/635/1*q2Efsx_XZxJ11DnP0zvk1Q.png" alt=""/></figure>



<p class="wp-block-paragraph" id="cf78">Thanks …</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/define-what-is-loop-and-what-are-the-types-with-syntax/">Define What is Loop and what are the Types with Syntax.</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/define-what-is-loop-and-what-are-the-types-with-syntax/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
