coroutine parameters change during

Hey

I have a question about a coroutine I’m doing.
My coroutine receives one parameter, sends a UnityWebRequest based on that parameter and logs its response

public IEnumerator UpdateApi(int value)
{
    if (_lastSentValue >= value)
        yield break;

    var url = GetUrl(value);

    using (UnityWebRequest req = UnityWebRequest.Get(url))
    {
        yield return req.SendWebRequest();				
        while (!req.isDone)
            yield return null;
        string response = Encoding.Default.GetString(req.downloadHandler.data);				
        Debug.Log(response);				
        _lastSentValue = value;
    }
}

In my update function I have

StartCoroutine(UpdateApi(_viewModel.Value));

_viewModel.Value can change constantly and I’m wondering how it will affect the coroutine?

if the coroutine was started with _viewModel.Value with a value of 20, and before it finished it is called again with 40.
What will happen?

thanks!

I understand your question, but you need to go 1 step back, in c# Int variables are not objects, when you pass an int to a method you are passing a copy, not the real variable, if you passed the int as a reference, or instead _view Model, then changing the int value would affect the variable inside the coroutine, I’m not sure if I’m being clear enough