Block() public static method

Create a sequential block of nodes
public static Block ( SourceLocation location ) : BlockNode
location SourceLocation
return Veil.Parser.Nodes.BlockNode
Example #1
0
 /// <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()
     });
 }