Skip to content

Instantly share code, notes, and snippets.

@raghubetina
Last active December 14, 2015 11:50
Show Gist options
  • Save raghubetina/5082227 to your computer and use it in GitHub Desktop.
Save raghubetina/5082227 to your computer and use it in GitHub Desktop.
5.times do |i| for (var i = 0; i < 5; i++) {
puts "howdy #{i}" alert("howdy " + i.toString());
end };
(10..20).step(2) do |i| for (var i = 10; i <= 20; i = i + 2) {
puts "howdy #{i}" alert("howdy " + i.toString());
end };
a = ["apple", "orange", "banana"] var a = ["apple", "orange", "banana"];
a.each do |fruit| for (var i = 0; i < a.length; i++) {
puts "My favorite fruit: #{fruit}" alert("My favorite fruit: " + a[i]);
end };
def say_weather function sayWeather() {
temp = "72 degrees" var temp = "72 degrees";
puts "It is " + temp alert("It is " + temp);
end };
def say_weather(temp) function sayWeather(temp) {
puts "It is " + temp alert("It is " + temp);
end };
do |temp| function(temp) {
puts "It is " + temp alert("It is " + temp);
end };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment