RosettaCodeData/Task/Variable-declaration-reset/Ruby/variable-declaration-reset-2.rb

11 lines
129 B
Ruby
Raw Permalink Normal View History

2026-04-30 12:34:36 -04:00
s = [1, 2, 2, 3, 4, 4, 5]
for i in 0..6
curr = s[i]
$prev
if i>0 and curr==$prev then
puts i
end
$prev = curr
end