Swift vocabulary words and syntax

Swift vocabulary words and syntax

memorize.aimemorize.ai (lvl 286)
Section 1

Preview this deck

Camel casing

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

4 years ago

Date created

Mar 1, 2020

Cards (42)

Section 1

(42 cards)

Camel casing

Front

var = programmingLanguage = "swift" More readable than just programminglanguage

Back

Example of an array

Front

var todo = ["Learn Swift", "Build App", "Deploy App"] println(todo.count)

Back

Binary? True or false (Boolean)

Front

Binary means that you can have either 1 or 0. A true or a false statement is a boolean. (var jonasIsInWVU = true)

Back

Swift and numbers

Front

Swift will assume that when you type a number without a decimal it is an Int and vise versa. You can also specify a number to a Double, Float, or Int if you want to. (var version: Double = 1.0 ) (var version = 1.0)

Back

Variable (var)

Front

It can be modified!

Back

Option and Clicking the function will explain what the function does.

Front

Explains what the function does.

Back

Example of Appending an Array

Front

var todo = ["Learn Swift", "Build App", "Deploy App"] todo.append ("Debug App") todo.append ("Fix Bugs") let item = todo.removeAtIndex(2)

Back

What is the answer: let z = 5 + 5 - 5 * 2

Front

Multiplication, Division, Remainder has a higher priority. Plus and minus has lower priority. Everything moves left to right. Answer: 0

Back

Binary Operators

Front

simple mathematical operations in code.

Back

var todo: [Double] = [6.1, 6.2, 6.3] todo.insert(6.0, atIndex: 0) println(todo)

Front

.insert will insert a new variable into the array in a specific area. You specify where by you writing after the atIndex:

Back

Float

Front

A number that can have a decimal point. It can have up to 7 decimal digits

Back

string interperlation

Front

println("Good morning \ (friendOfJonas)") This tells the computer that the input of println has a constant in it that is (friendOfJonas) \ = makes it constant

Back

How to count the number of variable in an Array?

Front

nameofvariable.count ----> numberofarrays

Back

10 + 5

Front

10 and 5 : Operand + : operator

Back

var str = "Hello, playground"

Front

var = is something to store "Hello, playground" str = Is a variable and is the box's name that stores the value "Hello, playground". You only need to declare a variable once. Meaning if you want to change it. You can change it by doing (str = "playground")

Back

append function?

Front

todo.append ("Conquer Swift") - This adds "Conquer Swift" to the todo array.

Back

todo.removeLast()

Front

It will tell us which item it removed in the array.

Back

Int (integer)

Front

A number that does not have a decimal point

Back

To remove a key from a value in a Dictionary

Front

countries.removeValueForKey("CA") var countries = [ "BE" : "Belgium", "FR" : "France", "US" : "United States of America" ]

Back

Updating a key is simple too in a Dictionary

Front

countries ["US"] = "United States of America" var countries = [ "CA" : "Canada", "BE" : "Belgium", "FR" : "France", "US" : "United States of America" ]

Back

(print) function?

Front

print is a FUNCTION not a command. Can take a string in quotes and a name of a variable: print("Hello there!") print(greeting)

Back

Double

Front

A number that can have a decimal point. It can have up to 15 decimal digits

Back

Immutable string

Front

unmodifiable string (let poop = "diarrhea")

Back

let areaInMeters = Double(area) / 10.764

Front

Double(area) : makes it so that the variable that you input is in decimals

Back

println V.S. print

Front

print command just prints whatever you give it. println makes the next print start on a brand new line.

Back

Concatenation

Front

Adding two or more stings together (let gross = "diarrhea" + poop)

Back

Console?

Front

Can print something within your program. To print something you need to type the command. [ print("Hello there!") ]

Back

unicode

Front

Industry Standard for characters

Back

Mutable string

Front

modifiable string (var poop = "diarrhea")

Back

todo.removeAtIndex(1)

Front

This will remove the 2nd variable in the array's index.

Back

+ - / * %

Front

+ : addition - : subtraction / : division * : Multiplication % : remainder

Back

Array Example:

Front

var todo: [String] = ["Apple", "Orange", "Lemon"] var todo: [Double] = [6.1, 6.2, 6.3] etc...

Back

Adding a new key value to the Dictionary

Front

countries["US"] = "United States" It will then add this to the array. var countries = [ "CA" : "Canada", "BE" : "Belgium", "FR" : "France", "US" : "United States" ]

Back

Dictionary in Swift

Front

var countries = [ "CA" : "Canada", "BE" : "Belgium", "FR" : "France" ] countries ["CA"] -----> This will give me "Some Canada"

Back

++ & --

Front

++ = increment unary operator -- = decrement unary operator

Back

How to add an Array to an already declared Array?

Front

var todo: [Double] = [6.1, 6.2, 6.3] todo += [6.4] or var todo: [Double] = [6.1, 6.2, 6.3] todo = todo + [6.4]

Back

Editing a Variable in an Array.

Front

You can only do this if the array is specified as Var. var todo = ["Learn Swift", "Build App", "Deploy App"] todo[2] = "Undeploy App" - This will update the "Deploy App" in todo to "Undeploy App"

Back

How to specify a variable type? (implicate type) Sting, number, or number with decimals?

Front

let word : String = "Hello"

Back

! What does that mean?

Front

NOT operator let off = !on : False

Back

IDE

Front

Integrated Development Enviroment

Back

Constant (let)

Front

it can not be modified!

Back


\t

Front


= after this the words are printed on a new line. \t = tabs the result.

Back