Created
November 25, 2016 09:38
-
-
Save EsterKais/8664c16abc265d036c079518a9a9be9a to your computer and use it in GitHub Desktop.
ChallengesForServiceSites
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
for number in 1..100 | |
if number % 3 == 0 && number % 5 == 0 | |
puts "MeowWoof!" | |
elsif number % 3 == 0 | |
puts "Meow!" | |
elsif number % 5 == 0 | |
puts "Woof!" | |
else | |
puts number | |
end | |
end |
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
sortasc = '1,42,313,31,455,343,90,91'.split(",").sort().join(",") | |
sortdec = '1,42,313,31,455,343,90,91'.split(",").sort().reverse!.join(",") |
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
a = 'Hello' | |
b = 'World' | |
puts "A was: #{a}" | |
puts "B was: #{b}" | |
a,b = b,a | |
puts "A is now: #{a}" | |
puts "B is now: #{b}" |
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
for (var i = 0; i <= 100; i++) { | |
if (i % 3 == 0 && i % 5 == 0) { | |
console.log("MeowWoof!"); | |
} | |
else if ((i % 3) == 0) { | |
console.log("Meow!"); | |
} | |
else if ((i % 5) == 0) { | |
console.log("Woof!"); | |
} | |
else { | |
console.log(i); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment