Get The Most Affordable Hosting in the World!
Starting at just $1.87/month, Vercaa offers unbeatable pricing for world-class web hosting services.
Fast, reliable, and secure hosting to power your website without breaking the bank. Plus, enjoy a free CDN for faster loading times worldwide!
Get Started Now!Since the array object behaves like a sequence, you can iterate through its elements with the help of for loop or while loop.
"for" Loop with Array
Take a look at the following example −
It will produce the following output −
1.0 2.0 3.0
"while L oop with Array
The following example shows how you can loop through an array using a while loop −
"for Loop with Array I ndex
We can find the length of array with built-in len() function. Use the it to create a range object to get the series of indices and then access the array elements in a for loop.
You will get the same output as in the first example.
The End! should you have any inquiries, we encourage you to reach out to the Vercaa Support Center without hesitation.