I want to add an item to an array, where one element depends on the result of another. Not sure if this can even work, but I haven't been able to test it since I'm not sure how to formulate an If statement to appending an array. Any help appreciated :)
appending the array
the if statement
appending the array
Code Block myHorses.append(Horse( //genotype gre: ["G", "g"][Int.random(in:0...1)]+["G", "g"][Int.random(in:0...1)], //phenotype greyPhenotype : UIImage //this is where I would add the if statement ))
the if statement
Code Block if gre == "Gg" { greyPhenotype : greyArray.randomElement() } if gre == "GG" { greyPhenotype : greyArray.randomElement() } if gre == "gg" { greyPhenotype : blankImage }