Que: Which of the following code snippet would traverse through all result objects ?

a. foreach(USER USER IN userResults){//checking the RESULT AS LIKE objectIF(USER.Role == ‘admin’){//do whatever you need}}
b. FOR(USER USER IN userResults){//checking the RESULT AS LIKE objectIF(USER.Role == ‘admin’){//do whatever you need}}
c. While(USER USER IN userResults){//checking the RESULT AS LIKE objectIF(USER.Role == ‘admin’){//do whatever you need}}
d. None of the mentioned
Answer: foreach(USER USER IN userResults){//checking the RESULT AS LIKE objectIF(USER.Role == ‘admin’){//do whatever you need}}

Leave a Comment