def while_loop(evaluator, ast, state):
    """Evaluates "while (cond) {body}"."""
    while evaluator.eval_ast(ast["cond"], state):
        res, do_return = evaluator.eval_ast(ast["body"], state)
        if do_return:
            return res, True
    return None, False