/// <summary>
/// Iterate a collection and execute the body block scoped to each item in the collection.
/// Optionally execute an empty block when there are no items to iterate
/// </summary>
/// <param name="collectionExpression">expression to load the collection</param>
/// <param name="body">Block to execute in the scope of each item</param>
/// <param name="emptyBody">Block to execute when there are no items in the collection</param>
public static IterateNode Iterate(ExpressionNode collectionExpression, BlockNode body, BlockNode emptyBody = null)
{
return(new IterateNode
{
Collection = collectionExpression,
Body = body,
EmptyBody = emptyBody ?? SyntaxTree.Block()
});
}