(Swift for Beginners) Swift continue Statement In this article, you will learn to use continue statement to transfer control of the program. While you are working with loops or conditional statements, you may require to skip some statements inside the loop or terminate the loop immediately without checking the test expression. In such cases, …
(Swift for Beginners) Swift break Statement In this article, you will learn to use break statement to transfer control of the program. When you are working with loops or conditional statements, you may require to skip some statements inside the loop or terminate the loop immediately without checking the test expression In such cases, break …
(Swift for Beginners) Nested Loops in Swift In this article, you will learn about nested loops and how it works, with examples. If a loop exists inside the body of another loop, it’s called a nested loop. Here’s an example of nested for-in loop. for i in 1…5 { //statements of outer loop for j …
(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 for Beginners) Swift for-in Loop In this article, you will learn about for-in loop, its use cases and variants. For-in loops are used to run a set of tasks for a certain number of times. These loops iterate over any sequences such as items in an array, range, or characters in a string. We …
(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 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 for Beginners) Swift Bitwise and Bit Shift Operators In this tutorial, you’ll learn about different bitwise operations in Swift. These are used for bit level computation in an expression. A bit is used to denote a binary digit. A binary digit can have two possible values either 0 or 1. As a beginner level …
(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 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, …