Add solutions
This commit is contained in:
parent
7417f01d5d
commit
b056b6ad81
96 changed files with 229 additions and 166 deletions
|
|
@ -115,21 +115,17 @@ pub fn main() void {
|
|||
// (Remember that want_it will be the index number of
|
||||
// the ingredient based on its position in the
|
||||
// required ingredient list for each food.)
|
||||
const found = for (wanted_ingredients) |want_it| {
|
||||
if (required_ingredient == want_it) break true;
|
||||
} else false;
|
||||
|
||||
// We did not find this required ingredient, so we
|
||||
// can't make this Food. Continue the outer loop.
|
||||
if (!found) continue :food_loop;
|
||||
for (wanted_ingredients) |want_it| {
|
||||
if (required_ingredient == want_it) break;
|
||||
} else continue :food_loop;
|
||||
}
|
||||
|
||||
// If we get this far, the required ingredients were all
|
||||
// wanted for this Food.
|
||||
//
|
||||
// Please return this Food from the loop.
|
||||
break;
|
||||
};
|
||||
break food;
|
||||
} else menu[0];
|
||||
// ^ Oops! We forgot to return Mac & Cheese as the default
|
||||
// Food when the requested ingredients aren't found.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue