My colleague forwarded me some code as below. I want to understand how symbol |
operates. I have a rough idea that it is looping through NutritionData
Tuple and storing unique values of food
into string Foods
. But is there something that I am missing? I searched for |
online but wasnt able to find anything.
tuple FoodNutrition
{
key string food;
key string nutrient;
float amountPerServing;
};
{FoodNutrition} NutritionData = ...;
{string} Foods = {nd.food | nd in NutritionData};
{string} Nutrients = {nd.nutrient | nd in NutritionData};