Name: return

Synonyms: cr, linefeed, lf

Type: constant

Syntax: return

Summary:
Equivalent to the line feed <character> (ASCII 10, Control-J).

Introduced: 1.0

OS: mac, windows, linux, ios, android

Platforms: desktop, server, mobile

Example:
local theData
put "Hello World" into theData
put return after word 1 of theData

Example:
local thisChar, aLongTextString
repeat for each char thisChar in aLongTextString
    if thisChar is return then
        exit repeat
    else
        -- do other stuff
    end if
end repeat

Description:
Use the <return> <constant> as an easier-to-read substitute for
<numToChar>(10) or <numToCodepoint>(10).

The <return> <constant> is needed because you can't type the <character>
it represents in a <script|scripting> <statement>.

The <return> <constant> is a synonym for the line feed character
(<ASCII> 10, Control-J). This is different from some other languages, in
which <return> is equivalent to the carriage return <character> (<ASCII>
13, Control-M). For most purposes, LiveCode translates the linefeed
<constant> and its synonyms into the appropriate end-of-line <character>
for the current operating system. However, you should keep this nuance
in mind when processing data from another system, which LiveCode has not
translated: <return> is *not* <ASCII> 13.

The line feed character is the standard end-of-line <delimiter> on
<Unix> systems. The end-of-line <delimiter> for <Mac OS> systems is a
carriage return (<ASCII> 13), and the end-of-line <delimiter> for
<Windows> systems is a carriage return followed by a line feed (<ASCII>
13 + <ASCII> 10). Internally, LiveCode always uses a line feed (<ASCII>
10) to end lines.

>*Note:* If you specify text mode with the <open driver>, <open file>,
> or <open process> <command|commands>, LiveCode translates line 
> feed <characters> to the appropriate end-of-line marker for the 
> current <platform(glossary)> before writing data, and translates the 
> current <platform(glossary)|platform's> end-of-line <delimiter> to a 
> line feed after reading data. If you specify binary mode with 
> these <command|commands>, LiveCode does not perform this automatic 
> translation. Likewise, if you put data into a <file> <URL> or get data 
> from it, end-of-line translation is performed, but not if you put data 
> into or get data from a <binfile> <URL>.

>*Note:* Starting with LiveCode v. 7, all text is stored as <Unicode>.
> If you send text outside LiveCode you should convert it to the desired 
> encoding using <textEncode>. If you receive text into LiveCode you 
> should convert it to Unicode using <textDecode>.

Changes:
The LF synonym was added in version 2.0.

References: constant (command), open driver (command),
open file (command), open process (command), CRLF (constant),
formfeed (constant), numToChar (function), numToCodepoint (function),
platform (function), textEncode (function), textDecode (function),
ASCII (glossary), command (glossary), delimiter (glossary),
Mac OS (glossary), platform (glossary), statement (glossary),
Unix (glossary), Unicode (glossary), Windows (glossary),
binfile (keyword), character (keyword), characters (keyword),
file (keyword), URL (keyword), script (property)

Tags: text processing

