Page 1 of 3
Posted: Wed Jan 11, 2012 5:13 pm
Ok pepe!! Ruby is coming... Ruby like Python, is a very powerfull language. Whitout shame... ask me, and... we can discuss about it. I recommend you Python and Ruby... the future in the present.
Posted: Thu Jan 12, 2012 1:27 am
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.
Posted: Sat Jan 14, 2012 5:30 pm
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:
-->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:
Moreover, you can write after:
And now pepe isn’t a integer, is a string.
-->In Python and Ruby you can return different things in a same method:
return bool ? 56 : "pepe is my friend"
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.
Posted: Tue May 15, 2012 9:06 pm
People tell me that Ruby is a strong language..
can you tell me something about it?
Posted: Fri May 18, 2012 1:25 am
well, that's it:
what's the principal structure on a ruby program?
Posted: Wed May 23, 2012 7:54 pm
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.
Posted: Wed May 23, 2012 8:47 pm
a simple program, the basic program, hello world!!, for example
and the declaration of a function..
I gotta go..
Posted: Sun Jun 03, 2012 11:32 pm
Here your example…:
--puts "Hello World!!"
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.
Posted: Tue Jun 05, 2012 7:07 pm
I see.. so I don´t have to write the ":" when I declare a function, rigth??
And, how can I read variables from the keyboard in ruby??
Posted: Wed Jun 06, 2012 10:45 pm
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
"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.