It is a Ruby convention to use #=> for describing expected returns. I realized that I use # => (with some space or tabs) myself. This is just a convention, and there is no formal specification, so I would like to ask what the convention is among Ruby programmers. Is
#=>the only correct way or is preferred,# =>is preferred, or- Either is almost equally used?
And, would there be any reasons to exclude or prefer one form?
I wouldn’t say it’s a convention. At least, I haven’t read anywhere about it. I use it myself only because my editor (TextMate) helpfully expands these markers when evaluating code. For example, if I type this line:
And then press TAB, it will insert
=>after the hash character. The line becomes this:Then if I press a shortcut, it will run the code and insert/update value of corresponding lines after the
# =>markers.Also, I personally think that
# =>looks much more readable than#=>.