Equivalent to the line feed character (ASCII 10, Control-J).Syntax:
local theData put "Hello World" into theData put return after word 1 of theData
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
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.
If you specify text mode with the open driver, open file, or open process 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's end-of-line delimiter to a line feed after reading data. If you specify binary mode with these 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.
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.
See also: open file (command),open process (command),CRLF (constant),formfeed (constant),numToChar (function),numToCodepoint (function),platform (function),textEncode (function),textDecode (function),script (property),