{(Int)} not identical to UInt8

Currently in use version beta 5 is fast and there should be a operator change +=

func dealCards1() -> [Int] {
    for i in 0...25{
        comp1PlayDeck += shuffledDeck[i]
    }
    return comp1PlayDeck
}

      

it throws '[(Int)]' is not identical to 'UInt8'

I'm not really sure what changes were made, but it's rather confusing.

+3


source to share


2 answers


I suspect the error is a change in the operator +=

, now it only concatenates Array

s and not a value Array

.

shuffledDeck[i]

does not return Array

. Making an array of its value is a traversal. Examples:



comp1PlayDeck += [shuffledDeck[i]]
comp1PlayDeck.append(shuffledDeck[i])

      

From the Beta5 docs:
"• The + = operator on arrays only concatenates arrays, it does not add an element. This removes the ambiguity working with Any, AnyObject, and related types. (17151420)!"

+9


source


Solved it by adding [] array name like this

[shuffledDeck[i]] 

      



I could still use the + = operator

0


source







All Articles