This file contains hidden or 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
var numSheep = 4; | |
var monthsToPrint = 12; | |
for(var monthNumber = 1; monthNumber <= monthsToPrint; monthNumber++) { | |
if (monthNumber % 4 = 0) { | |
numSheep *= .75; | |
var removed = numSheep; | |
console.log("Removing " + removed + " sheep from the population. Phew!"); | |
} else if (numSheep > 10000) { | |
numSheep /= 2; |
This file contains hidden or 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
beers = 99 | |
while beers > 0 | |
puts beers.to_s + ' bottles of beer on the wall, ' + beers.to_s + ' bottles of beer!' | |
beers -= 1 | |
if beers < 1 | |
puts "Ya take one down, pass it around, no more bottles of beer on the wall!" | |
else | |
puts 'Ya take one down, pass it around, ' + beers.to_s + ' bottles of beer on the wall!' | |
end |
NewerOlder