SyntaxFor Each element [As datatype] In group [statements] [Exit For] [statements] [Continue For] [statements] Next [element]
DescriptionDefines a loop that iterates through all items in a collection or array. element and group must be of compatible data types. The code within the loop is executed once for each element in group, with element being assigned to each successive element within group, one assignment per pass. The Exit For statement can be used at any time to exit the loop immediately. New in 2005. The Continue For statement can be used at any time to immediately jump back to the top of the loop and attempt to process the next iteration. The element variable is assigned the next element in group upon reaching the top of the loop. Usage at a Glance
Version Differences
See AlsoFor...Next Statement |