I’m creating a recipe directory and as data types I have Recipes and Ingredients, and Recipes have lists of Ingredients.
The challenge is that I don’t just need to store Ingredients, I need to store Ingredients and a quantity for each Ingredient, which is just a number. Can I have a list of pair values on a data type like Recipe?
The workaround I’m using right now is another data type, “Ingredient and Qty”, which has an Ingredient and a number for quantity, and the Recipe has a list of these. However, I’d rather not have to create a new data type here.
I have thought about letting Recipe have a list of Ingredients and a list of numbers, but I’m afraid it’ll be too difficult or unpredictable to make sure they remain in sync in terms of order.
Is there a standard way to just store a list that contains two values per item, or some other way to do this that doesn’t require an extra data type?