Value Literal Examples

These examples focus on the basic value types used inside YINI members: strings, booleans, numbers, and common literal forms.

Use this page when you want to compare value syntax directly. For sections and nesting, start with the Core YINI examples.


Strings

Strings must be quoted using single quotes, double quotes, or triple double quotes. Strings are raw by default; use an E or e prefix when escape sequences should be interpreted.

Strings at a glance

/* Common and useful string forms in YINI. */

@yini

^ StringsAtAGlance

// Ordinary strings are raw by default; backslashes are preserved.
name = "YINI"
path = "C:\Users\Kim\Projects\YINI"

// Escaped Strings interpret escape sequences.
message = E"Build finished.\nReady to continue."

// Triple-quoted strings are useful for multiline text.
description = """
YINI is a human-friendly
configuration format with
clear, predictable syntax.
"""

// Escaped triple-quoted strings also interpret escapes.
formatted = E"""
First line
Second line\tIndented
"""

Basic strings

# strings-and-escapes.yini
# Basic string examples.

^ Strings

^^ BasicStrings
# YINI strings must be quoted.
name = "Robin"
city = 'Stockholm'
message = "Hello, YINI"

^^ ChoosingQuotes
# Use the other quote type when the text contains a quote.
owner = "Amanda's file"
quoted_text = 'He said "hello"'

^^ RawByDefault
# Backslashes are ordinary text unless you use an Escaped String.
windows_path = "C:\Users\Kim\Documents"
literal_text = "Line 1\nLine 2"

Escaped strings

# string-escapes.yini
# Use Escaped Strings when escape sequences should be interpreted.

^ EscapedStrings

^^ NewlinesAndTabs
line_break = E"Line 1\nLine 2"
tabbed = E"key\tvalue"

^^ QuotesAndBackslashes
quoted = E"He said \"hello\""
folder = E"C:\\Users\\Kim\\Documents"

^^ LowercasePrefix
# The E prefix is case-insensitive.
message = e"Ready\nDone"

Multi-line strings

# string-multiline.yini
# Triple-quoted strings are useful for longer text.

^ MultiLineStrings

^^ RawBlock
description = """This text spans
more than one line.
Line breaks are preserved.
"""

^^ MessageTemplate
welcome_message = """Hello,

Welcome to the service.

Kind regards,
The Example Team
"""

Command Strings use lowercase command""" for multiline text with structural indentation removed. They produce ordinary strings; YINI does not execute their content.

Command Strings (RC7)

# Command Strings produce ordinary strings; YINI does not execute them.

^ Build

# Structural indentation is removed. Backslashes remain literal.
# The resulting value is "npm ci\nnpm run build", without a final newline.
steps = command"""
    npm ci
    npm run build
"""

String concatenation

# string-concatenation.yini
# Concatenation joins string values with +.

^ Concatenation

^^ ShortValues
title = "YINI: " + "Readable config"
label = "port-" + "8080"

^^ LongValues
# A line break may appear after +.
description = "Section markers " +
              "define structure."

^^ LenientScalars
# Later scalar operands are allowed only in lenient mode.
port_label = "port-" + 8080
enabled_label = "enabled-" + YES
empty_label = "value-" + null

# Decimal numbers retain their normalized source spelling.
exponent_label = "scale-" + 1e3       // "scale-1e3".
decimal_label = "ratio-" + 1.50      // "ratio-1.50".
hex_label = "mask-" + 0xFF          // "mask-255".

Booleans

Boolean literals

# boolean-literals.yini
# Boolean literals are case-insensitive.

^ FeatureFlags
search = true
dark_mode = ON
new_checkout = YES

^^ DisabledFeatures
legacy_api = false
debug_toolbar = OFF
beta_banner = NO

Numbers

The number examples include decimal values, signs, exponents, base prefixes, and underscore digit separators such as 12_345 and 1_234_567.

Number formats

# number-formats.yini
# Numeric literals and where they're useful.

^ Numbers

^^ Decimal
integer = 42
positive_integer = +42
negative_integer = -12
zero = 0

^^ Floats
ratio = 0.75
threshold = 1.25
temperature_c = -7.5
signed_decimal = +12.5

^^ Exponents
large = 3e4
precise = 1.23e4
small = 1e-6
explicit_plus = 6.022e+23
grouped_exponent = 1.5e1_0

^^ DigitSeparators
two_groups = 12_345
grouped_millions = 1_234_567
big_int = 1_000_000
bytes = 16_384
price = 12_345.67
precise_decimal = 1_000.5_25

^^ Binary
permissions = 0b1101
grouped_bits = 0b1111_0001
small_binary = 0b1010
prefix_separator = 0b_1010

^^ Octal
file_mode = 0o755
grouped_octal = 0o755_644

^^ Duodecimal
base_twelve = 0z2EX9
base_twelve_alt_digits = 0z2BA9
grouped_duodecimal = 0z_2EX9

^^ Hexadecimal
primary_color = 0x336699
feature_mask = 0x1F
grouped_hex = 0xCAFE_BABE
hex_color = hex:FFAA00
hex_color_grouped = hex:_FF_AA_00
uppercase_hex_prefix = HEX:FA90

Next steps