How to loop through an array from the second element in elegant way using Swift

后端 未结 4 771
无人及你
无人及你 2020-12-21 06:15

I am a beginner of Swift for iOS development, and want to find an elegant way to loop through an array from the second element.

If it is in Objective-C, I think I ca

4条回答
  •  遥遥无期
    2020-12-21 06:36

      if array.count>=2 {
         for n in 1...array.count-1{
             print(array[n])   //will print from second element forward 
          }
     }
    

提交回复
热议问题