funcgenerateMinutesWalk(minutes:Int)->[String]?{guardminutes%2==0else{print("Minutes is odd")returnnil}letcoordinates=["N","O","S","E"]vartravel=[String]()for_in0..<minutes/2{travel.append(coordinates[Int.random(in:0..<coordinates.count)])}travel.forEach{valueinifletindex=coordinates.firstIndex(of:value){travel.append(coordinates[(index+2)%coordinates.count])}}returntravel}
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
My solution in Swift language :