Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SWIFT

Swift Nested for Loop

// Swift program to display 7 days of 2 weeks

// outer loop
for week in 1...2 {
  print("Week: (week)")

// inner loop
    for day in 1...7 {
      print("  Day:  (day)")
  
   }

// line break after iteration of outer loop
   print("")
}
 
PREVIOUS NEXT
Tagged: #Swift #Nested #Loop
ADD COMMENT
Topic
Name
6+4 =