Line Continuation

From Xojo Documentation

Revision as of 23:33, 20 July 2019 by Gperlman (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Method

The underscore character, "_", is used as the line continuation character to indicate that a line of code is being continued on the next printed line of text in the Code Editor.

Usage

_ (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.

If you need to break up a text string into two lines in the Code Editor, place the _ keyword outside the quoted string, as in the example.

To enter the _ character and move to the next line, press Ctrl+Enter on Windows and Linux; on Macintosh, press Option-Return.

Sample Code

The following example uses the line continuation character to break a long string into two lines in the Code Editor. The _ keyword is used outside the quoted string and the + operator concatenates the two strings.

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