Last active
January 4, 2018 16:27
-
-
Save mattb20/838e0d84b2c49774d1e2bc93ebbd18ef to your computer and use it in GitHub Desktop.
While loop help
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 reverse_fun(n) | |
limit = n.length.to_i | |
n = n[0..limit-1].reverse | |
i = 0 | |
while i < limit-1 | |
n = n[0..i] + n[i+1..limit-1].reverse | |
i =+ 1 | |
end | |
end |
havenwood
commented
Jan 4, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment