Swift Flashcards
What is a nil value?
Nothing
What is the purpose of nil?
Used to represent the absence of a value.
Can ints be assigned to nil?
False
Can ints be assigned to objects?
False
What is a function?
Self contained chucks of code that performs a specific task.
Do you give a name to a function to be called upon?
Yes
What is a method?
Functions that are associated with a particular type.
What are some instance methods in swift?
Classes, structures, and enumerations because they all encapsulate a specific task.
What is a syntax?
Specific rules and symbols that are considered correctly structured in code.
Does every function in swift have a type?
True
What is a return statement?
Tells the program to return to the original address.
What is () called?
Placeholder
What does a if/else statement do?
If a condition is met execute the code else execute the second line of code.
> , =, <=
These are examples of what kind of operators?
Comparison Operators
What is an instance?
A var defined in a class.
What is nesting?
Loops that contain other loops.
What does % 2 == 0 do?
Tests evenness.
What does % 2 == 1 do?
Tests oddness.
What does sum do?
Causes the playground to print a total sum.
Are dictionaries ordered or unordered?
Unordered
What are dictionaries?
You type in a key (keyword) and the program returns a value.
What is initialization?
The process of preparing an instance, class, structure, enumeration for use.
What is … ?
A closed range operator.
What is hashable?
A special function that can change each key into a integer.