Can you do float + float

I want to do add a float to another float. Like this but this is not working. Can you even add floats? This is most likely a very dumb question. Note: I can not change this to ints for reasons.


public float timestorer;
public float timesaver;

timestorer += timesaver;

Certainly you can add floats. What you have above should work, assuming your two variables have been initialized to contain values. Here’s an example:

float a = 9.1f;
float b = 0.9f;
b += a;