Answers for "reverse! in ruby"

2

how to reverse array in ruby

# ruby
arr = [0,1,2]
# reverse
arr_rev = arr.reverse
# arr_rev = [2,1,0]; arr = [0,1,2]
arr == arr_rev.reverse!
# true
# ! immediately changes the value and stores it back to the variable
Posted by: Guest on December-25-2021
0

include? reverse ruby

if @players.exclude?(p.name)
    ...
end
Posted by: Guest on January-22-2021

Browse Popular Code Answers by Language