Created
March 9, 2017 04:36
-
-
Save itzsaga/e79a35658f0a07e2772ca50051603ee7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def swap_elements_from_to(array, index, new_index) | |
array[index], array[new_index] = array[new_index], array[index] | |
return array | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment