Veil.Parser.SyntaxTree.Iterate C# (CSharp) Method

Iterate() public static method

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
public static Iterate ( ExpressionNode collectionExpression, SourceLocation location, BlockNode body, BlockNode emptyBody = null ) : IterateNode
collectionExpression ExpressionNode expression to load the collection
location SourceLocation
body Veil.Parser.Nodes.BlockNode Block to execute in the scope of each item
emptyBody Veil.Parser.Nodes.BlockNode Block to execute when there are no items in the collection
return Veil.Parser.Nodes.IterateNode
        public static IterateNode Iterate(ExpressionNode collectionExpression, SourceLocation location, BlockNode body, BlockNode emptyBody = null)
        {
            return new IterateNode
            {
				Location = location,
                Collection = collectionExpression,
                Body = body,
                EmptyBody = emptyBody ?? SyntaxTree.Block(location)
            };
        }