How to convert a float to an int in Swift

In this post, We will share a Switch Statement on how to convert a float to an int in Swift and real-time output. This is a very basic program in Swift programming language. If you are Swift beginners or want to start learning Swift programming language, then this program will help you to understand the basic Swift programming.

How to convert a float to an int in Swift

Copy the below program and create a file named “FloatToInt.swift” and execute it.

In the above example, we have defined two variable Floatvar and IntVar to hold the float and integer values. With the help of Int() function, we change the float value to an integer.

Recommended Posts:


Editorial Staff

Editorial Staff at FreeWebMentor is a team of professional developers leads by Prem Tiwari

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Solved Programs