Member-only story
Logical Operators in Swift
|| && !
5 min readApr 10, 2020
Logical operators give you the ability to control program flow. They are so important that it is essential that we think about how these work in Swift.
This guide is here to help you, and give the guidance you need!
Difficulty: Beginner | Easy | Normal | Challenging
Prerequisites:
- Be able to produce a “Hello, World!” iOS application (guide HERE)
OR
- Use Swift Playgrounds to follow with the code (guide HERE)
WITH
- To understand the truth tables included below some basic knowledge of Binary for programmers would be useful (guide HERE)
- Some understanding of the meaning of business logic (guide HERE)
Terminology
Boolean: a data type is any data type that has either a true or false value, yes or no value, or on or off (1 or 0) value
Logical Operators: symbols that allow a program to make a decision based upon multiple condition
Truth Table: a mathematical table used in logic
Logical Operators
The general logical operators are defined in the truth tables
below which show the logical
…