Documentation/Reference

Multiline strings

Triple double quotes begin a block immediately followed by a newline. The closing delimiter may follow content. Ordinary doubled-quote literals keep their meaning; """word""" is still the ordinary literal containing "word".

name="Fred"
message=DEDENT TRIM f"""
    Hello {name}.
        Count: {42:06d}
"""
PRINT message

This prints Hello Fred. followed by an indented Count: 000042. Modifiers belong to the expression and also work in arguments, defaults and FORMAT options.

Form Behavior
""" newline … """ Preserve content, quotes, braces, indentation and original LF/CRLF/CR bytes
DEDENT """ Remove the common exact space/tab prefix of nonblank content lines
TRIM """ Remove boundary newline sequences only
DEDENT TRIM """ or TRIM DEDENT """ Dedent, then trim; duplicate modifiers are errors
f""" Apply existing checked interpolation/format specifications after layout processing

Opening/closing indentation is content. A closing line’s spaces survive a raw or TRIM-only literal; DEDENT can remove their matching common prefix. Tabs are exact characters, independent of editor tab width. Whitespace-only lines do not select the common prefix; they lose their matching prefix and retain extra spaces/tabs. If all lines are blank there is no common margin to remove.

TRIM never removes horizontal whitespace or interior newlines and never leaves half a CRLF. Ordinary TRIM(text) still removes surrounding whitespace. No backslash escapes are introduced. Six consecutive quotes inside a block represent three literal quotes. In a quote run, each six-quote group is escaped; a remaining three to five quotes closes the block, retaining zero to two preceding quotes. One or two remaining quotes are ordinary content.

Plain blocks treat braces literally. Formatted blocks use {expression:spec} and {{/}} escapes, as ordinary f-strings do. Each interpolation expression remains single-line; its value may contain newlines/indentation. Layout processing never changes characters supplied by an interpolation. Interpolated expressions retain ordinary checked effects and constant-expression restrictions; interpolation does not turn a runtime call into a constant default.

From the BASIL documentation. View source ↗

Find your way around BASIL

Type to search the manual.