Snippets tagged “loops”
15 snippets use this tag.
- break out of if and foreachPHP
To break out of a loop in PHP, you can use the break statement.
- How do I break out of nested loops in Java?Java
To break out of nested loops in Java, you can use the break statement. The break statement terminates the innermost loop that it is contained in, and transfers control to the statement immediately following the loop.
- How to Convert String to Title Case with JavaScriptJavaScript
Read this JavaScript tutorial and learn information about the combinations of methods that make it possible to convert the string to title case easily.
- How to Copy Array Items into Another ArrayJavaScript
Read this JavaScript tutorial and learn several useful methods of copying array items into another array. Get to know which method to choose for your case.
- How to Create a Two Dimensional Array in JavaScriptJavaScript
The two-dimensional array is an array of arrays. Read this JavaScript tutorial and find out several methods of creating two dimensional arrays easily.
- How to Find the Min/Max Elements in an Array in JavaScriptJavaScript
Read this JavaScript tutorial and learn about the methods used to find the minimum and maximum number of elements in an array. Find the fastest solution.
- How to Find the Sum of an Array of NumbersJavaScript
Read this JavaScript tutorial and learn several methods used to find or calculate the sum of an array of numbers. Also, find which is the fastest one.
- How to Get the First Key Name of a JavaScript ObjectJavaScript
Read this JavaScript tutorial and learn about two methods of getting the first key name of an object. Get one-liner codes and make your work done properly.
- How to Get the Index of an Array that Contains Objects in JavaScriptJavaScript
Read this JavaScript tutorial and learn several useful, fast and simple methods that are used for getting the index of an array that contains objects.
- How to Loop through an Array in JavaScriptJavaScript
The most common ways to loop through an array in JavaScript are the for, for/in and while loops. See how to use them. Examples.
- How to Loop Through Array and Remove Items Without Breaking the For LoopJavaScript
Read this JavaScript tutorial and learn some useful information about the method of looping through an Array and removing items without breaking for loop.
- How to Loop Through or Enumerate a JavaScript ObjectJavaScript
Read this tutorial and learn several useful methods of looping through or enumerate a JavaScript object. Try and copy the piece of the code right away.
- How to Split Array into ChunksJavaScript
Read the tutorial and find several easy and fast approaches to splitting a JavaScript array into smaller chunks. Choose one of the methods and try examples.
- How to Use Continue and Break in PHPPHP
The continue and break keywords are used to control the whole program flow. This snippet will show you examples of how to use these keywords in PHP.
- PHP foreach with Nested Array?PHP
To loop through a nested array in PHP using a foreach loop, you can use nested foreach loops.