Swift – Convert to absolute value October 15, 2022 by Tarik The standard abs() function works great here: let c = -8 print(abs(c)) // 8