from typing import Callable
from typing import Dict


def loop(setup: Callable, cond: Callable, func: Callable) -> Dict:
    """A for loop like in C, C++, Rust, etc. Every function gets a dictionary for talking between them.

    Args:
        setup (Callable): The function that gets called before the loop
        cond (Callable): The condition function returns True or False
        func (Callable): The function to call for each iteration

    Returns:
        Dict: The dictionary
    """
    gls = {}
    setup(gls)
    while cond(gls):
        func(gls)
    return gls