Data Types in Swift

We are going to discuss Data Types in Swift article. This will solve all your doubts. Let’s go into the article.

The data type of any programming language is a set of information containing set meanings and unique variables. You must use different types of variables to store information during programming in any programming language.

The data type of any programming language is a set of data with fixed meanings and variables that are unique.

Data Types in Swift

Data Types in Swift

  • Int or UInt − It is used for integers. More specifically, Int32 can use Int64 to define a 32 or 64 bit signed integer, while UInt32 or UInt64 can be used to define 32 or 64 bit unsigned integer variables.
  • Float − It is used to denote 32-bit floating point numbers and numbers with smaller decimal points. For example, 3.14159, 0.1 and -273.158.
  • Double − It is used to indicate a 64-bit floating point number and the floating point values ​​must be very large. For example, 3.14159, 0.1 and -273.158.
  • Bool − It refers to the Boolean value, which is true or false.
  • String − This is a collection of sorted characters. For example, “Hello, world!”
  • Character − This is a single character string. For example, “C”
  • Optional − This represents a variable that can hold either a value or no value.
  • Tuples − This is used to group multiple values in single Compound Value.

the maximum and minimum values which can be stored in such types of variables:

Int81byte-127 to 127
UInt81byte0 to 255
Int324bytes-2147483648 to 2147483647
UInt324bytes0 to 4294967295
Int648bytes-9223372036854775808 to 9223372036854775807
UInt648bytes0 to 18446744073709551615
Float4bytes1.2E-38 to 3.4E+38 (~6 digits)
Double8bytes2.3E-308 to 1.7E+308 (~15 digits)

Read Also:

Final Words

Data Types in Swift We hope you find this article very useful. Let us know how this article helps you through the comment box.

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Deekshi. Here, I post about programming to help developers.

Share on:

Leave a Comment