percentages

I want to know how to format doubles. In the program I have 4.3333 I just want to print 4 to the screen. I just want to print whole numbers. I'm using Swiftui with xcode. Please help. Thank you.

Look up String(format:). You'll want something like:

String(format: "%.0f", 4.3333)  // Returns "4"

thank you

I can't find anything on String(format:). When I run that it returns 0.

percentages
 
 
Q