Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8399413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:17:57+00:00 2026-06-09T21:17:57+00:00

I am learning Ruby, and in the book I use, there is an example

  • 0

I am learning Ruby, and in the book I use, there is an example code like this

#...
restaurant = Restaurant.new
restaurant.name = "Mediterrano"

restaurant.description = <<DESC
One of the best Italian restaurants in the Kings Cross area, 
Mediterraneo will never leave you disappointed
DESC

#...

Can someone explain to me what <<DESC means in the above example? How does it differ from the common string double quote?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T21:17:58+00:00Added an answer on June 9, 2026 at 9:17 pm

    It is used to create multiline strings. Basically, ‘<< DESC’ tells ruby to consider everything that follows until the next ‘DESC’ keyword. ‘DESC’ is not mandatory, as it can be replaced with anything else.

    a = <<STRING
    Here
    is
    a
    multiline
    string
    STRING
    

    The << operator is followed by an identifier that marks the end of the document. The end mark is called the terminator. The lines of text prior to the terminator are joined together, including the newlines and any other whitespace.
    http://en.wikibooks.org/wiki/Ruby_Programming/Here_documents

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While learning Rails, I found this example in the Sam Ruby's book: app/controllers/line_items_controller.rb def
I'm currently learning Ruby and RoR and I stumbled across this declaration: link_to_remote(name, options
I have the following ruby code, from a learning to program book. I understand
I am learning Ruby and found this code sample in some documentation: require 'find'
I am learning ruby from this guide http://ruby.railstutorial.org/ruby-on-rails-tutorial-book#sec:deploying , and I am trying to
I am learning Ruby and I set up a controller like this: class Mobile::HomeController
I am learning Ruby on Rails. I made a simple link like this: <%=
I've just started learning ruby, so this question is simple. I created @subject in
I'm learning ruby (have a java/groovy background) and it looks like when writing methods,
I am learning rais from the rails tutorial book: http://ruby.railstutorial.org/chapters/sign-in-sign-out#fnref:9.14 I am working on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.