Tag Archives: Swift programming

Swift programming for Beginners – Swift while and repeat while Loop

(Swift for Beginners) Swift while and repeat while Loop In this article, you will learn to create while and repeat…while loops in Swift programming. In the previous article, we learned about for-in loop to run a set of tasks for a certain number of times. In this article, you will learn to use while and repeat..while as an alternative of for-in …

Swift programming for Beginners – Swift switch Statement

(Swift for Beginners) Swift switch Statement In this article, you will learn to use switch control statements to control the flow of your program’s execution. The switch statement is also a variety of Swift control statement e.g.if-else, guard etc., that performs different actions based on different conditions. The beauty of switch statement is, it can compare a …

Swift programming for Beginners – Swift if, if…else Statement

(Swift for Beginners) Swift if, if…else Statement In this article, you will learn to use two conditional statements: if and if…else to control the flow of your program’s execution. In programming, you may want to perform different actions based upon the specified condition is true or false (which is known only during the run time). For such cases, control …

Swift programming for Beginners – Swift Ternary Conditional Operator

(Swift for Beginners) Swift Ternary Conditional Operator In this article, you will learn to use conditional or ternary operator to alter control flow of the program. The ternary conditional operator “? :” is a shorthand for if-else statement. The syntax for ternary conditional operator is: condition ? value1 : value2 How ternary conditional operator works? Here’s how …

Swift programming for Beginners – Swift Operator precedence and associativity

(Swift for Beginners) Swift Operator precedence and associativity In this article you will learn about the rules used to evaluate a expression with operators and operands. Swift Operator precedence Operator precedence is a collection of rules used in order to evaluate a given mathematical expression. When there are several operators used in a single expression, …

Swift programming for Beginners – Swift Operators

(Swift for Beginners) Swift Operators In this article, you’ll learn everything about different types of operators in Swift programming language, their syntax and how to use them with examples. Operators are special symbols (characters) that carry out operations on operands (variables and values). Some basic operations includes assigning, changing, combining and checking values. For example, + is …