Skip to content

Instantly share code, notes, and snippets.

@san9dev
Last active June 1, 2021 09:43
Show Gist options
  • Save san9dev/77fbc3687f4d74f7063432f159a8a234 to your computer and use it in GitHub Desktop.
Save san9dev/77fbc3687f4d74f7063432f159a8a234 to your computer and use it in GitHub Desktop.
str = "string"
start_index = 0
end_index = str.length - 1
center = end_index/2
while end_index > center
str[start_index], str[end_index] = str[end_index], str[start_index]
start_index += 1
end_index -= 1
end
puts str
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment