Literals
Post
Literals
A literal is a value that is specified directly in the source code. Ballerina supports the following literals.
| Literals | Examples |
|---|---|
| Nil Literal | (), null |
| Boolean Literal | true or false |
| Integer Literal | 123, 0x1A |
| Floating Point Literal | 456.78, 12.3f, 12.3d, 1.23e3, 0X1a.A |
| String Literal | "Hello, World!" |
| Byte Array Literal | base16 `AB 12 34`base64 `A1z+` |
Inferring the Type of a Numeric Literal - The Algorithm.
This topic has been moved to its own page to make it easier to find.
Article

Nil Literal
Nil literal uses the syntax () and null.
Article

Boolean Literal
Boolean literal syntax is used to write Boolean values. A boolean true is written as true and a …
Article

Integer Literal
Integer values can be expressed in either common the Decimal system, known for its base 10 format, …
January 1, 2023Article

Floating Point Literal
Floating point values can be expressed in either Decimal (base 10) or Hexadecimal (base 16) systems …
January 1, 2023Article

String Literal
A string literal can be written by having the Unicode code points wrapped using two double quotes …
January 1, 2023Article

Byte Array Literal
Byte Array Literal is a sequence of bytes represented in base16 or base64.
January 1, 2023