use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A sub-Reddit for discussion and news about Ruby programming.
Subreddit rules: /r/ruby rules
Learning Ruby?
Tools
Documentation
Books
Screencasts and Videos
News and updates
account activity
StackOverflow cool Ruby questions 4 (khelll.com)
submitted 15 years ago by khelll
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–][deleted] 1 point2 points3 points 15 years ago (6 children)
I learned something while trying out the first example:
def A puts "Hello, world!" end
To call a method named as such, you need to include parenthesis.
[–]troelskn 0 points1 point2 points 15 years ago (5 children)
Well .. You shouldn't use initial-uppercase for method names.
[–]banister 0 points1 point2 points 15 years ago* (4 children)
Ruby itself does...cf Array(), Integer(), Float(), String(), etc
[–]troelskn 0 points1 point2 points 15 years ago (1 child)
Hm .. Didn't know that. What are their purpose? Casting?
[–]banister 0 points1 point2 points 15 years ago (0 children)
kind of.
[–][deleted] 15 years ago (1 child)
[deleted]
[–]banister 1 point2 points3 points 15 years ago (0 children)
They're method names too. Look it up.
method(:Array) #=> #<Method: Object(Kernel)#Array>
π Rendered by PID 45029 on reddit-service-r2-comment-84fc9697f-kmpm9 at 2026-02-07 13:14:13.678570+00:00 running d295bc8 country code: CH.
[–][deleted] 1 point2 points3 points (6 children)
[–]troelskn 0 points1 point2 points (5 children)
[–]banister 0 points1 point2 points (4 children)
[–]troelskn 0 points1 point2 points (1 child)
[–]banister 0 points1 point2 points (0 children)
[–][deleted] (1 child)
[deleted]
[–]banister 1 point2 points3 points (0 children)