Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SWIFT

while Loop Swift

// program to display numbers from 1 to 5

// initialize the variable
var i = 1, n = 5

// while loop from i = 1 to 5
while (i <= n) {
  print(i)
   i = i + 1
}
Source by www.hackingwithswift.com #
 
PREVIOUS NEXT
Tagged: #Loop #Swift
ADD COMMENT
Topic
Name
4+2 =