Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

arrays with for loops

// For-All variant
// Go through the elements backwards
// by adjusting the for-loop
public void forAllBackwards(int[] nums) {
  for (int i = nums.length-1; i>=0; i--) {
    System.out.println( nums[i] );
  }
}
Source by codingbat.com #
 
PREVIOUS NEXT
Tagged: #arrays #loops
ADD COMMENT
Topic
Name
2+8 =