Jump to content
xisto Community
Sign in to follow this  
cobaltchloride

Ruby - Cool Syntax Scripting language Ruby

Recommended Posts

Of all the programming languages I have come accross, there is no language which is as fun to use and easy to program in as Ruby.

The iterators in the language and the use of code blocks is just excellent. It takes just an hour or so to get used to the philosphy of Ruby and bang... u can just program anything easily in the language. I strongly recomment it to anyone interested in programming.

e.g.

1.upto(10) {|x| puts x}

prints numbers from 1 to 10.

"abcdef".reverse!

reverses the string to fedcba.

Cool :)

Share this post


Link to post
Share on other sites

how about functionality? i mean i haven't used ruby to be honest so i havn't got a massive knowladge on the subject. However it is just a scripting languare (please correct me if i am wrong) and if people want to do simple programming such as what you described a language like VB.net or something would be more handy since it is more intuative and allows more advanced programming when the user feels adept enough.

Share this post


Link to post
Share on other sites

how about functionality? i mean i haven't used ruby to be honest so i havn't got a massive knowladge on the subject. However it is just a scripting languare (please correct me if i am wrong) and if people want to do simple programming such as what you described a language like VB.net or something would be more handy since it is more intuative and allows more advanced programming when the user feels adept enough.

<{POST_SNAPBACK}>


You can do with ruby everything you can do with VB.Net etc. It has support to windows API, cool gui (FXRuby), OLE automation, xml parsing etc. There are free libraries available to extend the language. Although Ruby satisfies the definition of a scripting language, it would be gross injustice to label it only a scripting language. It has a full range of object oriented features enabling anyone to write entire applications in the language.

 

I strongly recommend anyone looking for a perfect programming language to use Ruby. I was very skeptical at first but now I even use it to program excel files instead of VBA.

Share this post


Link to post
Share on other sites

Is this language a web programming language or is it for application software for individual computers like VBA?I have yet to read about it yet. Can anyone help to provide more information, please?Thank you.

Share this post


Link to post
Share on other sites

Is this language a web programming language or is it for application software for individual computers like VBA?

 

I have yet to read about it yet. Can anyone help to provide more information, please?

 

Thank you.

<{POST_SNAPBACK}>


You can find out more information at Ruby Language.

 

It is an all purpose programming language - for web and desktop applications.

Share this post


Link to post
Share on other sites

Ruby is the interpreted scripting language for quick and easy object-oriented programming. It has many features to process text files and to do system management tasks (as in Perl). It is simple, straight-forward, extensible, and portable.
Oh, I need to mention, it's totally free, which means not only free of charge, but also freedom to use, copy, modify, and distribute it.


Wow, that sounds nice! I shall learn this programming language! cobaltchloride, have you learned C or C++ before? Is Ruby easier than those?

Share this post


Link to post
Share on other sites

No. Ruby is much easier than c or c++. Let me know how u fare in learning it.

<{POST_SNAPBACK}>


Is Ruby much easier to learn than C/C++?

 

Well, that depends on how much you already know about those languages. I use Ruby from time to time, but I can't see it replacing my heavy usage of C/C++ programming. It's good for scripting, and can sometimes outperform PERL. The only downfall I guess, is that it wasn't around sooner.

 

Now I haven't actually encountered any means of compiling it into binary, I just use .rb files filled with scripting commands to perform simple tasks and execute it as if it were a binary file. This method is considered an interpretted language, which is basically scripting but Ruby does claim to be an OOP language and can be compiled I assume.

 

Just with those commands listed above, you can run Ruby when it's installed by console just by typing ruby, you then do:

 

1.upto(10) {|x| puts x}^D

Should probably explain this code:

 

The above sets the first number to start from, in this case number 1.upto(10) suggests that it starts at 1 and goes upto 10, we assign it with x, when then print x out with puts in C++ terms:

for(int x = 1; x <= 10; x++)    cout << x << endl;

Remember ^D = Ctrl+D and will perform the typed commands and exit when finished.

 

So the second code will be displayed:

 

puts "abcdef".reverse^D

How we do this in C++, well to make it easier, we'll use the algorithm header file to include the reverse function, but remember there are other ways, and quite possibly more efficient than this method:

 

#include <algorithm>#include <iostream>using namespace std;int main(void){    char szString[] = "abcdef";    reverse(szString, szString + strlen(szString));    cout << szString << endl;    return 0;}

Cheers,

 

 

MC

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.