iOS Swift Collections and Control Flow Control Flow With Conditional Statements Working With Logical Operators

Make sure you're appending the correct values to the results array in order to pass

How do i go about

operators.swift
var results: [Int] = []

for n in 1...100 {
    // Enter your code below
 if (n % 7 == 0 && 2 != 0)
 results.append(n)

    // End code 
}

2 Answers

Nathan Fulkerson
Nathan Fulkerson
iOS Development with Swift Techdegree Student 28,944 Points

By the looks of the sample code you provided, you're missing curly braces following your if statement, which your results.append statement should be contained within.

var results: [Int] = []

for n in 1...100 { // Enter your code below if (n % 7 == 0 && 2 != 0) { results.append(n) } // End code } I tried this but It can’t work