Complete the code to declare a Boolean variable set to true.
let isSunny: Bool = [1]In Swift, Boolean values are lowercase true or false. Using true sets the variable to a Boolean true value.
Complete the code to check if both conditions are true using a logical AND operator.
let canGoOutside = isSunny [1] hasFreeTimeThe logical AND operator in Swift is &&. It returns true only if both sides are true.
Fix the error in the code by choosing the correct logical NOT operator.
let isRaining = false
let shouldTakeUmbrella = [1]isRainingThe logical NOT operator in Swift is !. It flips a Boolean value from true to false or vice versa.
Fill the blank to create a Boolean expression that is true if either it is weekend or you have no homework.
let canRelax = isWeekend [1] noHomeworkThe logical OR operator || returns true if at least one condition is true.
Fill all three blanks to create a Boolean expression that is true if the word's length is greater than 3 and the word is not empty.
let word = "apple" let condition = (word.count [1] 3) [2] (word [3] "")
This code checks if a word's length is greater than 3 and the word is not empty. The operators used are > for comparison, && for logical AND, and != for not equal.