# Calculate reaction time and store

Hi there,
So I’m building a VR game based on reaction times. I want to calculate the time taken between two bools being set and then store that time somehow. This will be happening multiple times within a set period. Once that period is over, I was thinking to calculate what the fastest, slowest and average reaction time was. I think I can figure out how to calculate the times, but I don’t know is how to store these in a list, or array or whatever and then calculate and show the different times taken. I’m pretty new to coding and lists somewhat confuse me but it seems this is the sort of thing I need. Any help is much appreciated.
Duncan

As for counting the time: once you make the first bool `True`, you can start adding `Time.deltaTime` to a variable, or you can set one variable to Time.time, then once it finishes, place another one and subtract one from another.

And for example, once both of these bools are true, launch a method that adds it to a list and resets the variables.

As for lists, to use them, you need to add `using System.Collections.Generic` namespace at the top of your script. Once you do, you can declare it this way

`List<T> myList = new List<T>();`

and here, instead of `T` you’d write `float`, so you could store floats inside it. Once you have it declared `myList.Add(timeVariable)` and it will be added to a list. You might want to use Dictionaries, so you could differentiate different player times and such.

It works similarly `Dictionary<TKey, TValue> myDictionary = new Dictionary<TKey, TValue>();`.

Here, instead of `TKey` you write a type, for example `string` and for `TValue` you’d write `float`. That means it creates a dictionary, where you can pass in a string for a key, to get the value.

I know it’s not the most clear explanation, but mess around a bit and shoot if you don’t understand something.

Thanks so much, this works great!