samedi 2 juillet 2016

Cannot subscript a value of type [String] with an index of type "UInt32"

i've been trying to create a code to generate random names. Here it is

import UIKit

 let arrayOfNames: [String] = ["Giovanni", "Simone", "Francesco", "Ahmet",       "Valerio", "Federico"]

 let arrayOfsNames: [String] = [" İl Genio", " Lo scemo", " Verga", " Fermi", " Medici", " L'assasino"]

 var casual1 = arc4random_uniform(7)
 var casual2 = arc4random_uniform(7)

 let name = "\(arrayOfNames[casual1]) + \(arrayOfsNames[casual2])"

  name

however on the "let name" line it gives me the mistake on the title. Does anyone know why and how to solve it?




Aucun commentaire:

Enregistrer un commentaire