why can't append testarray2? got error binary operator '+=' connot applied operands of type '[any]' , '[int]' when did this:
var testarray : [any] = [10,20,45,32] var testarray2 : [int] = [10,20,45,32] var somearray : [any] = [] somearray += testarray somearray += testarray2
well, not way += defined:
func +=<t, c: collectiontype c.generator.element == t>(inout lhs: [t], rhs: c) the where c.generator.element == t part specifies types of elements in collection you're trying add (int in case) must match exactly types of elements in first array (any).
Comments
Post a Comment