@Override
    public ZemObject eval(Interpreter interpreter) {
        ZemObject onVariable = interpreter.getVariable(onVariableNode.getName(), onVariableNode.getPosition());
        ZemObject ret = null;
        if (onVariable instanceof ZemArray) {
            String asVariableName = asNode.toString();
            for (ZemObject element : (ZemArray) onVariable) {
                interpreter.setVariable(asVariableName, element);
                ret = loopBody.eval(interpreter);
            }
            return ret;
        } else if (onVariable instanceof Dictionary) {
            DictionaryEntryNode entryNode = (DictionaryEntryNode) asNode;
            String keyName = ((VariableNode) entryNode.getKey()).getName();
            String valueName = ((VariableNode) entryNode.getValue()).getName();
            for (Map.Entry<ZemObject, ZemObject> entry : (Dictionary) onVariable) {
                interpreter.setVariable(keyName, entry.getKey());
                interpreter.setVariable(valueName, entry.getValue());
                ret = loopBody.eval(interpreter);
            }
            return ret;
        } 
        
        
        
        
        /* added by Jing Shu and Abdoul Diallo */
        else if (onVariable instanceof ZemSet) {
        	String asVariableName = asNode.toString();
            for (ZemObject element : (ZemSet) onVariable) {
                interpreter.setVariable(asVariableName, element);
                ret = loopBody.eval(interpreter);
            }
            return ret;
        }
        /* end of code added by Jing Shu and Abdoul Diallo */
        
        
        
        
        
        throw new InvalidTypeException("foreach expects an array or dictionary.", onVariableNode.getPosition());
    }