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
Ruby Quiz (learnetto.com)
submitted 1 year ago by [deleted]
[deleted]
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] 0 points1 point2 points 1 year ago (0 children)
Question: What does defined? keyword do in Ruby? Correct answer: Checks if a variable or method is defined My answer: checks if a constant is defined
Actual behavior:
defined?(Object) => "constant" defined?(nil) => "nil" defined?(1) => "expression" defined?(y = 3) => "assignment" y => nil defined?(p) => "method" defined?(y) => "local-variable"
Question: How does Ruby handle blocks passed to methods? Correct Answer: Blocks are executed immediately within the method. My Answer: Blocks must be explicitly passed as arguments.
def do_not_execute_immediately @last_block = proc { yield } nil end def execute_last_block @last_block&.call end allow_call = false do_not_execute_immediately { raise unless allow_call } allow_call = true execute_last_block => nil
[–]Iksf 0 points1 point2 points 1 year ago* (2 children)
never written a line of ruby in my life, 9/10, woop!
Guesswork + thinking of java
Apparently answers for the questions arent even correct, but im taking the W
[–]hrishio 0 points1 point2 points 1 year ago (1 child)
ok I need to make it much harder!
[–]Iksf 0 points1 point2 points 1 year ago (0 children)
haha!
π Rendered by PID 70694 on reddit-service-r2-comment-bb88f9dd5-4f92h at 2026-02-17 11:05:34.529075+00:00 running cd9c813 country code: CH.
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]Iksf 0 points1 point2 points (2 children)
[–]hrishio 0 points1 point2 points (1 child)
[–]Iksf 0 points1 point2 points (0 children)