added different types of variables used in Swift 4 (#26877)

* added different types of variables used in Swift 4

* updated index.md

removed unnecessary prefix Swift
This commit is contained in:
Alen Garibović
2019-02-11 12:38:37 +01:00
committed by Manish Giri
parent 342d8657a5
commit da9ddc882c

View File

@ -38,6 +38,20 @@ To test if your variables have the correct value, use `print()`.
// This prints 50 // This prints 50
``` ```
### Swift 4 supports the following basic types of variables:
```Int or UInt ``` This is used for whole numbers. More specifically, you can use Int32, Int64 to define 32 or 64 bit signed integer, whereas UInt32 or UInt64 to define 32 or 64 bit unsigned integer variables. For example, 42 and -23.
```Float ``` This is used to represent a 32-bit floating-point number. It is used to hold numbers with smaller decimal points. For example, 3.14159, 0.1, and -273.158.
```Double ``` This is used to represent a 64-bit floating-point number and used when floating-point values must be very large. For example 3.14159, 0.1, and -273.158.
```Bool ``` This represents a Boolean value which is either true or false.
```String ``` This is an ordered collection of characters. For example, "Hello, World!"
```Character ``` This is a single-character string literal. For example, "C"
#### More Information: #### More Information:
* [The Swift Programming Language](https://docs.swift.org/swift-book/LanguageGuide/TheBasics.html#ID310) * [The Swift Programming Language](https://docs.swift.org/swift-book/LanguageGuide/TheBasics.html#ID310)