Multiple choice technology web technology

How does a "for" loop start?

  1. for (i = 0; i <= 5)

  2. for i = 1 to 5

  3. for (i <= 5; i++)

  4. for (i = 0; i <= 5; i++)

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

A for loop in C-style languages has three parts separated by semicolons: initialization; condition; increment. Option D correctly shows for (i = 0; i <= 5; i++). Options A, B, and C are missing one or more required parts.