示例#1
0
        protected override string GetHeader()
        {
            if (InitialAssignment == null)
            {
                throw new MissingMandatoryElementException("Initial declaration is required in loop statement");
            }

            if (BreakCondition == null)
            {
                throw new MissingMandatoryElementException("Break condition is required in loop statement");
            }

            if (StepInstruction == null)
            {
                throw new MissingMandatoryElementException("Step instruction is required in loop statement");
            }

            return($"for ({InitialAssignment.GenerateCode()}; {BreakCondition.GenerateCode()}; {StepInstruction.GenerateCode()}) {{\n");
        }