Searching for: Blocks in Swift
If Statement
Language: Swift

The if else block controls decision making by checking true/false statements resulting in different executions of code, depending on if the result is true and if the result is false. There are three parts to the if-else block: if, else if, and else.

Functions
Language: Swift

A function is a block of code that can be called from another location in the program or class. Functions declared within a class are known as methods. Specifically, they are declared as below, they are known as instance methods.

Ternary Operator
Language: Swift

The ternary operator is used to execute code based on the result of a binary condition. It takes in a binary condition as input, which makes it similar to an 'if-else' control flow block. It also, however, returns a value, behaving similar to a method.

Switch Case
Language: Swift

A switch case is used test variable equality for a list of values, where each value is a case. When the variable is equal to one of the cases, the statements following the case are executed. In Swift, a switch case can contain a temporary let constant, which contains the variable's value. This let constant can be used in a booleanExpression, which if true, will evaluate statements


< Previous Page   |   Next Page >