Ruby
Re: Ruby
I have heard a lot of great things about Ruby, and to learn it has been on my "to do" list for a while now.
But of course, for contest programming I still recommend you guys C++: nothing compares to the speed of this language (you know, because there is no VM running it). Those extra seconds can mean the difference between an AC and a TLE (and I speak from experience here
).
But yes, Ruby is coming. We will continue working to add to our judge as many languages as possible.
But of course, for contest programming I still recommend you guys C++: nothing compares to the speed of this language (you know, because there is no VM running it). Those extra seconds can mean the difference between an AC and a TLE (and I speak from experience here

But yes, Ruby is coming. We will continue working to add to our judge as many languages as possible.
Ruby
My opinion is the same. C and C++ are very fast, that don’t have discussion. But… in C and C++ you have to implement almost everything. Itch! That is a problem… and big! For example, in Ruby for the big powers of 3 you most only write:
puts 3**gets.to_i
In Pthon:
print 3**input()
-->The numbers in Python and Ruby are very big. In this languages aren’t the problems of the numbers of 32 and 64 bits.
-->In Python and Ruby you don’t need write the type of a variable, the language recognize it in execution time. This is a powerful and interesting tool, because that made dynamic the variables. If you want, I'll explain you this philosophy deeper.
For example… in C,C++,C#,Java,… you would write:
int pepe = 56;
In Python and Ruby you only write:
pepe=56
Moreover, you can write after:
pepe=”friend”
And now pepe isn’t a integer, is a string.
-->In Python and Ruby you can return different things in a same method:
In Ruby:
def Something(bool)
return bool ? 56 : "pepe is my friend"
end
In Python:
def Something(bool):
return 56 if bool else “pepe is my friend”
-->I thing I have stop here because I excite easy with the facilities of this languages. We will see in a next class.
puts 3**gets.to_i
In Pthon:
print 3**input()
-->The numbers in Python and Ruby are very big. In this languages aren’t the problems of the numbers of 32 and 64 bits.
-->In Python and Ruby you don’t need write the type of a variable, the language recognize it in execution time. This is a powerful and interesting tool, because that made dynamic the variables. If you want, I'll explain you this philosophy deeper.
For example… in C,C++,C#,Java,… you would write:
int pepe = 56;
In Python and Ruby you only write:
pepe=56
Moreover, you can write after:
pepe=”friend”
And now pepe isn’t a integer, is a string.
-->In Python and Ruby you can return different things in a same method:
In Ruby:
def Something(bool)
return bool ? 56 : "pepe is my friend"
end
In Python:
def Something(bool):
return 56 if bool else “pepe is my friend”
-->I thing I have stop here because I excite easy with the facilities of this languages. We will see in a next class.

Re: Ruby
Jajajaja In my opinion, Ruby is a strong language for the same reason that Python is a strong language. If you understand why Python is a strong language, you understand why Ruby is a strong language. In my opinion Python and Ruby is almost the same, with the difference that one recognize for indentation and the other, no (have another big differences, but I said that for you can have an idea in the similarity).
Can you be more specific when you say “structure”? Because I understand by “structure” many things.
Can you be more specific when you say “structure”? Because I understand by “structure” many things.
Re: Ruby
Here your example…:
def printHelloWorld()
--puts "Hello World!!"
end
printHelloWorld()
I put the “Hello World” in a function, because you want the declaration of a function.
In Ruby are a “print” too, but “print” is like a “printf(“Hello World”);” in C++ (without the ‘\n’ at the end). You see?? Is almost like Python.
def printHelloWorld()
--puts "Hello World!!"
end
printHelloWorld()
I put the “Hello World” in a function, because you want the declaration of a function.
In Ruby are a “print” too, but “print” is like a “printf(“Hello World”);” in C++ (without the ‘\n’ at the end). You see?? Is almost like Python.

Re: Ruby
In the previous post I wrote how you can read variables from the keyboard in ruby, but, fine, I´ll repat it.
In Ruby you read with "gets" and the string have methods to convert to "int" or to other types:
For example, to convert a string to int:
pepe = "45"
pepe = pepe.to_i
#Now pepe is equal to 45(interger)
For this reason, you can write:
pepe = gets.to_i
See it!!!
"to_i" is a function. I have not commit an error in write "pepe.to_i" and not "pepe.to_i()". In Ruby the parenthesis is optional.
In Ruby you read with "gets" and the string have methods to convert to "int" or to other types:
For example, to convert a string to int:
pepe = "45"
pepe = pepe.to_i
#Now pepe is equal to 45(interger)
For this reason, you can write:
pepe = gets.to_i
See it!!!
"to_i" is a function. I have not commit an error in write "pepe.to_i" and not "pepe.to_i()". In Ruby the parenthesis is optional.