void ProcessArrayFor(ParsingScript script,string forString) { int index = forString.IndexOf(Constants.FOR_EACH); if (index <= 0 || index == forString.Length - 1) { throw new ArgumentException("Expecting: for(item : array)"); } string varName = forString.Substring(0,index); ParsingScript forScript = new ParsingScript(forString); Variable arrayValue = forScript.ExecuteFrom(index + 1); int cycles = arrayValue.TotalElements(); int startForCondition = script.Pointer; for (int i = 0; i < cycles; i++) { script.Pointer = startForCondition; Variable current = arrayValue.GetValue(i); ParserFunction.AddGlobalOrLocalVariable(varName, new GetVarFunction(current)); Variable result = ProcessBlock(script); if (result.IsReturn || result.Type == Variable.VarType.BREAK) { script.Pointer = startForCondition; SkipBlock(script); return; } } }