Section 1

Preview this deck

=

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 1, 2020

Cards (189)

Section 1

(50 cards)

=

Front

assignment operator

Back

var x: (Int, String)

Front

declare variable x of tuple groups together an Int and a String

Back

print("x = \(x)")

Front

insert current value of variable x in string "x = " with string interpolation

Back

- unary minus operator

Front

Back

bool

Front

type represented basic Boolean

Back

x.y

Front

access the value of named element y of tuple let x = (y: 1, z: "1")

Back

var x:String

Front

provid type annotation for variable x, to indicate that the variable can store String values

Back

*/

Front

multicomments end

Back

//

Front

start of single line comments

Back

do { try x() } catch {}

Front

error handling of x function

Back

print(x, terminator: "")

Front

print current value variable x without a line break after

Back

var

Front

keyword for declaring variables

Back

UInt8

Front

type represented unsigned 8-bit number with no fractional component

Back

Double(x)

Front

integer value x to Double

Back

Int

Front

integer type, which has the same size as the current platform's native word size

Back

assert(_:_:file:line:)

Front

definition of assert function

Back

1.25e2

Front

double literal 1.25 x 10 times 2 in sintific notation

Back

Int64

Front

type represented 64-bit number with no fractional component

Back

0x11

Front

integer literal in hexadimical notation

Back

print(x)

Front

print current value of variable x

Back

Int32

Front

type represented 32-bit number with no fractional component

Back

nil

Front

value of valueless state variable

Back

UInt

Front

unsigned integer type, which has the same size as the current platform's native word size

Back

/*

Front

multicomments start

Back

0b10001

Front

integer literal in binary notation

Back

Int8.min

Front

access minimum value of 8-bit integer

Back

print(_:separator:terminator:)

Front

definition of print function

Back

true, false

Front

Boolean constant values

Back

typealias new_type = UInt16

Front

define alternative name new_type for existing type UInt16

Back

var x, y, z: Double

Front

define multiple related variables of the type Double on a sinlge line

Back

0xFp-2

Front

double literal 15 x 2 times -2 in sintific and hexadimical notation

Back

%

Front

remainder operator

Back

precondition(_:_:file:line:)

Front

definition of precondition function

Back

let x: Int!

Front

declare optinal variable x of Int type for implicit unwrapping

Back

let cat = ""; print(cat)

Front

write two separate statements let cat = "" and print(cat) on a single line

Back

Double

Front

type represented a 64-bit floating-point number

Back

func x() throws {}

Front

declare function x that can throw an error

Back

Int8

Front

type represented 8-bit number with no fractional component

Back

Int16.max

Front

access maximum value of 16-bit integer

Back

0o21

Front

integer literal in octal notation

Back

Float

Front

type represented a 32-bit floating-point number

Back

tuple

Front

group multiple values of any type into single compound value

Back

let

Front

keyword for declaring constants

Back

+,-,*,/

Front

arithmetic operators

Back

Int?

Front

type represented optional type of Int

Back

if let y = x {}

Front

optional binding of optional's variable x with variable y in if statements

Back

x!

Front

forced unwrapping of optional's value x

Back

Int16

Front

type represented 16-bit number with no fractional component

Back

let x = (y: 1, z: "1")

Front

declare variable x with tuple,name the individual elements in tuple y: 1, z: "1"

Back

x = "Value"

Front

set variable x of type String to string value "Value"

Back

Section 2

(50 cards)

...x

Front

one side range to x

Back

"""x"""

Front

multiline string literal "x"

Back

for char in string {}

Front

access individual Characters char for String string by iterating over the string with for statement

Back

==

Front

comparison operator equal to

Back

\r

Front

carriage return in string

Back

x.hasPrefix("xyz")

Front

check whether a string x has prefix "xyz"

Back

x.remove(at: x.startIndex)

Front

remove single character from string x at index startIndex

Back

String type represented string

Front

Back


Front

line feed in string

Back

<

Front

comparison operator less than

Back

\0

Front

null character in string

Back

<=

Front

comparison operator less than or equal to

Back

!=

Front

comparison operator not equal to

Back

1-8

Front

number of hexadimical digits in Unicode scalar

Back

x.removeSubrange(x.startIndex...x.index(x.endIndex, offsetBy: -2))

Front

remove a substring from string x at range from first index to endIndex - 2

Back

[Double]

Front

Array type Double short syntax

Back

>

Front

comparison operator greater than

Back

x.hasSuffix("xyz")

Front

check whether a string x has suffix "xyz"

Back

&&

Front

logical operator and

Back

var x = String()

Front

declare variable x with initialization a new String

Back

x...y

Front

close range operator from x to y inclusive

Back

x.index(of: "!")

Front

get index of "!" character in string xyz

Back

x[..<x.index(x.startIndex, offsetBy: 3]

Front

get substring from string x that include 2 first character of string x

Back

|| logical operator or

Front

Back

condition ? true_statement : false_statement

Front

ternary conditional operator for condition, true_statement and false_statement

Back

x.endIndex

Front

property of string x to access the position after the last Charecter

Back

x.insert(contentsOf: "xyz", at: x.startIndex) insert String "xyz" into a string x at the startIndex

Front

Back

x ?? b

Front

nil-coalescing operator

Back

\t

Front

horizontal tab in string

Back

x.indices

Front

property of string x to access all of the inidces of individual chatacter in string

Back

x[x.startIndex]

Front

get start Charecter from string x

Back

Array<Double>

Front

Array type Double full syntax

Back

\

Front

escape character in strings

Back

x.startIndex

Front

property of string x to access the position of the first Charecter

Back

x + y

Front

concatenate string x with character y

Back

"x"

Front

string literal "x"

Back

\\

Front

backslash in string

Back

!

Front

logical operator not

Back

+=,-=

Front

compound assignment operators

Back

var x = ""

Front

declare variable x as empty string assing an empty string literal

Back

Charecter

Front

type represented character

Back

>=

Front

comparison operator greater than or equal to

Back

x.count

Front

property of string x to retrieve a count of the character values in string

Back

x...

Front

one side range from x

Back

+ unary plus operator

Front

Back

x.insert("!",at: x.endIndex) insert Charecter "!" into a string x at the endIndex

Front

Back

\u{n}

Front

arbitrary Unicode scalar n in string

Back

x.index(_ :offsetBy:befor:after:)

Front

method of string x which corresponds to the position of each Charecter in the string

Back

x..<y

Front

half-open range operator from x to y exclusive

Back

String(["x","y","z"])

Front

construct string by passing an array of characters "x","y","z"

Back

Section 3

(50 cards)

x[i]

Front

get item indexed i by subscript syntax for array x

Back

for (index, item) in x.enumerated() {}

Front

iterate over array x with the for statement getting the integer index for each item

Back

x.append(1)

Front

add a new item 1 to the end of array x

Back

x.isSuperset(of: y)

Front

method to determine whether a set contains all of the values in set y

Back

x.isEmpty

Front

property for checking whether the count of array x is equal to 0

Back

x.splice([0, 1], atIndex: 0)

Front

insert array [0, 1] into array x at index 0

Back

x.isEmpty

Front

property for checking whether the count of set x is equal to 0

Back

x.removeAll()

Front

remove all items from set

Back

+=

Front

alternative for append item in an array

Back

[0, 2, 4, 34].map({String($0)})

Front

get new aray with items from [0, 2, 4, 34] make them type of String

Back

x.remove[:at 0]

Front

remove item from array x at index 0

Back

x.isEmpty

Front

property for checking whether the count of dictionary x is equal to 0

Back

x.union(y)

Front

method to create a new set with all of the values in both sets x and y

Back

x.insert[1, at: 0]

Front

insert 1 into array x at index 0

Back

x[y]

Front

subscript syntax for dictionary x, key y

Back

[1, 2, 3, 4]

Front

result of [1, 2] + [3, 4]

Back

x.isSubset(of: y)

Front

method to determine whether all the values of set x are contained in set y

Back

x.insert[1, at: 0]

Front

insert 1 into set x at index 0

Back

x.isStrictSuperset(of: y)

Front

method to determine whether a set contains all of the values in set y, but sets x and y not equal

Back

var x: Set<String> = ["x", "y", "z"] creating variable x of type Set<String> initialized by an array literal with items "x", "y" , "z"

Front

Back

x.contains(1)

Front

check whether set x containst item 1

Back

x.count

Front

porperty of array x to find out number of items in array

Back

x.remove[:at 0]

Front

remove item from set x at index 0

Back

set

Front

collection of the same type values with no difined ordering

Back

x.count

Front

get number of items in set x

Back

Array(repeating: 0.0, count: 3)

Front

Creating array of Double with default value 0.0 with 3 elements

Back

x.sorted()

Front

method of set x that return the set's elements as an array using < operator

Back

[0, 2, 4, 34].filter({$0 > 20})

Front

get new aray with items from [0, 2, 4, 34] that greater then 20

Back

Dictionary<key, value>

Front

Dictionary syntax with key and value

Back

x.intersection(y)

Front

method to create a new set with only the values common to both sets x and y

Back

[Int]()

Front

Creating empty array of Int short syntax

Back

x.isDisjoin(with: y)

Front

method to determine whether two set have no values in common

Back

x[y] = z

Front

add new item in dictionary x with key y value z

Back

[0, 2, 4, 34].reduce({$0 > $1})

Front

reduce array [0, 2, 4, 34] to one single value

Back

[String: Int]()

Front

create emepty dictionary of type String for key and Int for value short syntax

Back

x.updateValue(z, forKey: y)

Front

update value in dictionary x set value z for key y

Back

x.count

Front

get number of items in dictionary x

Back

[1, 2]

Front

Array literals with elements 1, 2

Back

for item in x {}

Front

iterate over array x with the for statement

Back

x.removeLast()

Front

remove last item from array x

Back

[key: value]

Front

Short hand syntax for Dictionary with key and value

Back

Dictionary<String, Int>()

Front

create empty dictionary of type String for key and Int for value full syntax

Back

x.removeValue(forKey: y)

Front

remove item form dictionary x where key equal y

Back

x.subtracting(y)

Front

method of set x to create a new set with values not in set y

Back

x.isStrictSubset(of: y)

Front

method to determine whether all the values of set x are contained in set y, but sets x and y not equal

Back

Set<Type>

Front

set type syntax

Back

Dictionary

Front

collectin stores associations between keys of the same type and values of the same type

Back

Set<Character>()

Front

create an empty set

Back

x.symmetricDifference(y)

Front

method to create a new set with values in either set x or y, but not both

Back

["x" : 1, "y" : 2]

Front

dictionary literal with items "x" : 1, "y" : 2

Back

Section 4

(39 cards)

func x(_ y: Double...) {}

Front

define function x with variadic parameter y of type Double with ommmited argument lable without return value

Back

break label_name

Front

break labeled statement label_name

Back

enum x {case y, z}

Front

enumeration x with cases y, z on a single line

Back

func x() {}

Front

define function x without paramters and return value

Back

case (let x, 0):

Front

switch with case matching tuple (a, b) where a bind to x and b equal 0

Back

if condition {} elese if {} else {}

Front

if statement for condition

Back

func x(y: Int) -> Int {}

Front

define function x with parameter y of type Int with return value of type Int

Back

switch value {case value: statement default: break}

Front

switch start for value

Back

enum x: Int { case y = 5 }

Front

enumeration enumeration x with case y with Type of rowValue of type Int assigned raw value 5

Back

{$0 > $1}

Front

closure function takes two values x, y return the value of statement x > y, short hand syntax

Back

while condition {}

Front

while statement with condition

Back

func x(_ y: Int = ) {}

Front

define function x with parameter y of type Int with ommited argument label with default parameter value

Back

stride(form:to/through:by)

Front

function for ger integer range from other types

Back

func x() -> (y: Int, z: String) {}

Front

define function without parameters with multipel return values y or type Int, and z of type String

Back

guard condition {} else {}

Front

guard syntax

Back

case let (x, y) where x == y:

Front

switch with case matching tuple (a, b) where a bind to x and b bind to y and x == y

Back

enum x: Int { case y} enumeration x with case y with Type of rowValue of type Int

Front

Back

for i in 1..5 {}

Front

use for-in loop with numeric ranges

Back

enum x: Int { indirect case y(x)} recursive enumeration x with case y

Front

Back

break

Front

statement for end execution of an entire control flow statement

Back

continue

Front

statement for stop current loop and start again at the beginning of the next iteration through the loop

Back

{(Int, Int) -> String in body}

Front

closure function takes two Int value and return String with body}

Back

case "a", "A":

Front

make switch with single case for both "a" and "A"

Back

(Int, Int) -> String

Front

function type takes two Int value and return String

Back

label_name: while condition {}

Front

labeled statement while with condition

Back

for (key, value) in x {}

Front

iterate over dictionary by key, value with for statement

Back

_

Front

wildcard pattern, to match any possible value

Back

case 5..<12:

Front

switch with case matching interval from 5 to 12 exclusive

Back

func x(arg_x x: Int) {}

Front

difine function with parameter x of type Int with argument label arg_x without return value

Back

case (1, 1):

Front

switch with case matching tuple

Back

#available(iOS 10, macOS 10.12, *)

Front

availability condition for platform name iOS 10, version macOS 10.12, *

Back

fallthrough

Front

C-like switch behavior

Back

enum x { case y case z}

Front

define enumeration with cases y and z

Back

{x, y in body}

Front

closure function takes two values x, y with body inferring types form context

Back

repeat {} while condition

Front

repeate statement for condition

Back

enum x {case x(Double)} enumeration x with case x with associated value of type Double

Front

Back

func x(y: inout Double) {}

Front

define funciton x with inout parameter y of type Double

Back

_

Front

ommited argument label for first parameter in function

Back

@escping () -> Void

Front

escaping closure without parematers and return value

Back