Method

# Line Continuation

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

The underscore character, "\_", is used as the <span class="title-ref">Line Continuation</span> character to indicate that a line of code is being continued on the next printed line of text in the Code Editor.

## Usage

``` xojo
_ ' (used as the last character in a line)
```

## Notes

Use the underscore character as the last character in a printed line of text in the Code Editor to indicate that you are continuing the line of code on the next printed line in the Code Editor. The compiler will then treat the second printed line as a continuation of the first line. When you use the \_ keyword, the Code Editor indents the next line automatically, as is shown in the example.

To enter the \_ character and move to the next line, press `Ctrl Enter` on Windows and Linux; on macOS, press `⌥ Return`. Adding the `Shift` key to either of these combinations will add a call to the `EndOfLine</api/text/endofline>` object.

## Sample code

The following example uses the <span class="title-ref">Line Continuation</span> character to break a long string into two lines in the Code Editor. The \_ keyword is used outside the quoted string and the `+</api/language/operators/mathematical/+>` operator concatenates the two strings.

``` xojo
Var SaveChangesDialog As New MessageDialog
SaveChangesDialog.Explanation = "Hint: If you don't save, you will " _
  + "lose your work since your last Save."
```

<div class="note">

<div class="title">

Note

</div>

Include comments within line continuation, you can put the Line Continuation character before the comment, as demonstrated below:

</div>

``` xojo
Var s As String = "test" + _
  "string" + _
  _ // Comment here
  "continuation"
```

## Compatibility

|                       |     |
|-----------------------|-----|
| **Project Types**     | All |
| **Operating Systems** | All |
