Challenge 2: Comments & Running a Script — Solution Save this as profile.rb, then run it from the command line with: ruby profile.rb # profile.rb # A short script that prints a name, a favorite number, and whether # that number is even or odd. =begin This block comment documents the script's purpose: it demonstrates both single-line comments (the # lines above and below) and Ruby's dedicated =begin/=end block comment syntax, which PHP and Python don't have a direct equivalent of. =end name = "Philip" # a string holding the name favorite_number = 7 # an integer to check puts "Name: #{name}" puts "Favorite number: #{favorite_number}" if favorite_number.even? puts "#{favorite_number} is even" else puts "#{favorite_number} is odd" # .even? returns false, so this runs end =begin Output: Name: Philip Favorite number: 7 7 is odd Notes: - ruby profile.rb runs the file directly from the command line, same as php profile.php or python profile.py — no separate compile step. - .even? is a method call directly on the integer literal/variable, already previewing the "everything is an object" idea from the chapter. - The =begin/=end block above the code is Ruby's dedicated block-comment syntax; PHP and Python instead reuse /* */ or triple-quoted strings for the same purpose. =end