List Iteration with a Condition
In a content management system, a feature is needed to count the number of articles that are longer than 500 words. Given a list of article word counts, which of the following loops correctly implements this feature?
A
for (wordCount > 500 in articleWordCounts) { count++; }
B
for each (wordCount in articleWordCounts) { if (wordCount > 500) count++; }
C
foreach wordCount in articleWordCounts { if (wordCount > 500) count++; }
D
for each wordCount > 500 in articleWordCounts { count++; }
APFIVE