for Loop

Get introduced to the for loop in C++.

Introduction

Suppose you have a coupon to buy five ice-creams free of cost. You know in advance how many free ice-creams you can buy.

In the era of programming, we can use the for loop for such situations.


The for loop keeps executing a particular code block as long as the given condition is true.

Syntax

Let’s go over the syntax of the for loop.

The general syntax of the for loop consists of a for keyword followed ...