Created
May 7, 2020 03:10
-
-
Save ajtran303/5483f5332b215d87c85e44a731a9af9f to your computer and use it in GitHub Desktop.
Ruby Loops
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
```ruby | |
3.times { print "Beetlejuice " } | |
counter = 3 | |
while counter > 0 | |
print "Beetlejuice " | |
counter -= 1 | |
end | |
counter = 3 | |
until counter == 0 | |
print "Beetlejuice " | |
counter -= 1 | |
end | |
counter = 3 | |
loop do | |
print "Beetlejuice " | |
counter -= 1 | |
if count == 0 | |
break | |
end | |
end | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment