Skip to content

Instantly share code, notes, and snippets.

@mattb20
Last active January 4, 2018 16:27
Show Gist options
  • Save mattb20/838e0d84b2c49774d1e2bc93ebbd18ef to your computer and use it in GitHub Desktop.
Save mattb20/838e0d84b2c49774d1e2bc93ebbd18ef to your computer and use it in GitHub Desktop.
While loop help
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
Copy link

def reverse_fun
  i = 0

  while i < 2
    puts i
    i =+ 1

    sleep 0.5
  end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment