Created
September 22, 2019 08:33
-
-
Save vovs03/df143a7b39b9da37c80273ce1b97a608 to your computer and use it in GitHub Desktop.
Traffic-ligths.rb
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
# Эмулятор работы светофора: | |
# Переключение рандомного цвета | |
# с интервалом через 5 секунд. | |
puts "Traffic-light is works!" | |
puts "" | |
sleep 2 | |
def switch_color | |
light = ['Green', 'Yellow', 'Red'] | |
10.times do | |
puts light.sample | |
puts "" | |
puts "---" | |
sleep 5 | |
end | |
end | |
switch_color |
Author
vovs03
commented
Sep 22, 2019
- выполнение задачи
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment