# Literals¶

Literals are the basic building blocks of expressions. They describe a fixed, constant value.

## Int Literals¶

Int literals denote integers. They use the expected syntax. For example, the integer three is written as `3`

.

## Float Literals¶

Float literals denote floating point numbers. There are two ways to specify them:

**Decimal form**: One half can be written as`0.5`

. Note that neither the integer part nor the decimal part can be omitted, so`.5`

and`0.`

are syntax errors.**Scientific notation**: Writing very large or very small numbers in decimal notation can be cumbersome. In those cases, scientific notation is helpful. For example, one thousandth can be written in Safe-DS as`1.0e-3`

or`1.0E-3`

. You can read this as`1.0 × 10⁻³`

. When scientific notation is used, it is allowed to omit the decimal part, so this can be shortened to`1e-3`

or`1E-3`

.

## String Literals¶

String literals describe text. Their syntax is simply text enclosed by double quotes: `"Hello, world!"`

. Various special characters can be denoted with *escape sequences*:

Escape sequence | Meaning |
---|---|

`\b` |
Backspace |

`\f` |
Form feed |

`\n` |
New line |

`\r` |
Carriage return |

`\t` |
Tab |

`\v` |
Vertical tab |

`\0` |
Null character |

`\'` |
Single quote |

`\"` |
Double quote |

`\{` |
Opening curly brace (used for template strings) |

`\\` |
Backslash |

`\uXXXX` |
Unicode character, where `XXXX` is its hexadecimal code |

String literals can contain also contain raw line breaks:

In order to interpolate text with other computed values, use template strings.

## Boolean Literals¶

To work with truthiness, Safe-DS has the two boolean literals `false`

and `true`

.

`null`

Literal¶

To denote that a value is unknown or absent, use the literal `null`

.