Skip to content

Instantly share code, notes, and snippets.

@sfeatherstone
Created March 5, 2018 16:20
Show Gist options
  • Select an option

  • Save sfeatherstone/65136abf6a14d6be33e1253addbb5b25 to your computer and use it in GitHub Desktop.

Select an option

Save sfeatherstone/65136abf6a14d6be33e1253addbb5b25 to your computer and use it in GitHub Desktop.
//Copy using for loops
fun catTwoIntArrays2(array1 :IntArray, array2 :IntArray) : IntArray {
val newArray = IntArray(array1.size + array2.size )
for ((index, value) in array1.withIndex()) {
newArray[index] = value
}
for ((index, value) in array2.withIndex()) {
newArray[index + array1.size] = value
}
return newArray
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment