public override IElement Action(ArgumentContainer Args) { // let's assume that all parameters are collections of the form: // [condition-expr then-expr] foreach (var param in Args.GetRawRestArguments().Value) { if (param is Collection cond) { var values = cond.GetInnerValues(); if (values.Count == 2) { var testResult = Interpreter.VisitAndGetResult(values.First()); if (testResult is TrueFalse tf) { if (tf.Value == true) { return(Interpreter.VisitAndGetResult(values.Skip(1).First())); } // else move on to the next pair } else { throw new TypeException("Returned value to IF was not a boolean value!"); } } else { throw new TypeException("IF must recieve collections with exactly 2 items in each"); } } } return(new Noop()); }