How to make negative numbers into positive
If you want to force a number to change or keep it positive. Here is the way: abs() for int fabs() for double fabsf() for float If you want more info, you can look here: http://stackoverflow.com/
DetailsApple is replacing Objective-C by Swift.
Objective-C is 30 years old.
Still works but …
It’s time to go with something more intuitive and powerful in it’s way!
For the moment, I’m leaving this section …
Recommendation: If you start programming, go with Swift.
If you want to force a number to change or keep it positive. Here is the way: abs() for int fabs() for double fabsf() for float If you want more info, you can look here: http://stackoverflow.com/
DetailsChange a float to int in Objective-C The Code float valueFloat = slider.value; int valueInt = (int) valueFloat; Explanation 1-The inital value is received from a slider in the App (slider.value). That inital value received is 3.1415 and have 4 decimals (1415). That’s what we call in programming a »float ». 2-The slider.value 3.1415 is than…
Details