It's not necessarily a good thing, but in my opinion it's what allows me to write more expressive code quickly and easily. For example, simple checks:
In c++ to check a number is equal to zero we can do the following:
intnum=0;if(num==0){return"match";}
In ruby we can do it this way:
num=0ifnum.zero?"match"end
I prefer the ruby way of doing this as it is much simpler to read. It's closer to English. Ruby provides hundreds of useful methods, just take a look at the Numeric class in the ruby docs.
That's not to say one is better than the other. If you're looking for performance, then you are probably not going to be using ruby anyway.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
It's not necessarily a good thing, but in my opinion it's what allows me to write more expressive code quickly and easily. For example, simple checks:
In c++ to check a number is equal to zero we can do the following:
In ruby we can do it this way:
I prefer the ruby way of doing this as it is much simpler to read. It's closer to English. Ruby provides hundreds of useful methods, just take a look at the Numeric class in the ruby docs.
That's not to say one is better than the other. If you're looking for performance, then you are probably not going to be using ruby anyway.