converting negative float value to positive value

in my game i want to convert the negative float value to positive float value .i always want to automatically convert the the negative float value i got in the game to the positive float value.It should not display - symbol before the number.

Mathf.Abs() get your positive value.

EDIT(lol), easier way :

var = -var ;

And if you don’t want to flip the value when it’s positive, just check it before like this :

if ( var < 0 ){ var = -var };

Or var = var - (var * 2); // -12.765 =

  • 12.765 -(-25.530) = 12.765

12.765 - (12.765 *2) = -12.765 //Doesn’t work

Or var = var - (var * 2); // -12.765 =

  • 12.765 -(-25.530) = 12.765

12.765 - (12.765 *2) = -12.765 //Doesn’t work