ios - For loop based on array length in Swift -
ios - For loop based on array length in Swift -
i have been trying take length of array , utilize length set amount of times loop should execute. code:
if notes.count != names.count { notes.removeallobjects() var namearraylength = names.count index in namearraylength { notes.insertobject("", atindex: (index-1)) } } at moment error:
int not have fellow member named 'generator' seems simple issue, haven't yet figured out solution. ideas?
you need specify range. if want include namearraylength:
for index in 1...namearraylength { } if want stop 1 before namearraylength:
for index in 1..<namearraylength { } ios for-loop swift
Comments
Post a Comment