Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restricted-Array Hyunji Kim #11

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
got rid of another .each
ricecakemonster committed Aug 17, 2017
commit d36e7db66783b8c95de6f3677d3b1fb97c768ad2
4 changes: 3 additions & 1 deletion using_restricted_array.rb
Original file line number Diff line number Diff line change
@@ -44,10 +44,12 @@ def reverse(array, length) # Ruby
# Returns true if found, false otherwise.
def search(array, length, value_to_find)
return false if length == 0
length.times do |i|
i = 0
until i == length
if array[i] == value_to_find
return true
end
i += 1
end
return false
end