From da9ddc882c3bad07ffc1093264619adb25766e98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alen=20Garibovi=C4=87?= <35613986+agaribovic@users.noreply.github.com> Date: Mon, 11 Feb 2019 12:38:37 +0100 Subject: [PATCH] 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 --- guide/english/swift/variables/index.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/guide/english/swift/variables/index.md b/guide/english/swift/variables/index.md index 329a3d2304..3569eaa98d 100644 --- a/guide/english/swift/variables/index.md +++ b/guide/english/swift/variables/index.md @@ -38,6 +38,20 @@ To test if your variables have the correct value, use `print()`. // 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: * [The Swift Programming Language](https://docs.swift.org/swift-book/LanguageGuide/TheBasics.html#ID310)