编辑代码

struct Name:Identifiable{
    var name:String=""
    var id:Int=0
}


class NameList{
    var list:[Name]

    init(){
        self.list = []
    }
    init(data: [Name]){
        self.list = []
        self.list = data
    }
}


var a:NameList = NameList(data:[
    Name(name:"夕阳2",id:2),
    Name(name:"夕阳1",id:1)
    ])

    
print(a.list)
print(a.list.count)

a.list.forEach{item in
    print(item)

}


for item in 0..<5{
    if(item==2){
        continue;
    }
    print(item)
}