Review the solution for the nested iteration and selection statements challenge activity
The following code is one possible solution for the challenge from the previous unit.
c#Copy
string[] orderIDs = { "B123", "C234", "A345", "C15", "B177", "G3003", "C235", "B179" };
foreach (string orderID in orderIDs)
{
if (orderID.StartsWith("B"))
{
Console.WriteLine(orderID);
}
}
This code is merely “one possible solution” because a lot depends on how you decided to implement the logic. As long as you got the right results per the rules in the challenge, and you used an array and a foreach statement, then you did great!
If you succeeded, congratulations! Continue on to the knowledge check in the next unit.