Post

Literals

A literal is a value that is specified directly in the source code. Ballerina supports the following literals.

LiteralsExamples
Nil Literal(), null
Boolean Literaltrue or false
Integer Literal123, 0x1A
Floating Point Literal456.78, 12.3f, 12.3d, 1.23e3, 0X1a.A
String Literal"Hello, World!"
Byte Array Literalbase16 `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

Nil literal uses the syntax () and null.

January 1, 2023

 Article

Boolean Literal
Boolean Literal

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

January 1, 2023

 Article

Integer Literal
Integer Literal

Integer values can be expressed in either common the Decimal system, known for its base 10 format, …

January 1, 2023

 Article

Floating Point Literal
Floating Point Literal

Floating point values can be expressed in either Decimal (base 10) or Hexadecimal (base 16) systems …

January 1, 2023

 Article

String Literal
String Literal

A string literal can be written by having the Unicode code points wrapped using two double quotes …

January 1, 2023

 Article

Byte Array Literal
Byte Array Literal

Byte Array Literal is a sequence of bytes represented in base16 or base64.

January 1, 2023
Literals

Navigation

Site Settings

Site Theme

Source Code Density