Post

Boolean Lang Library

The Ballerina Boolean lang library ( ballerina\lang.boolean ) provides functions that operate on a boolean value. As of now, it has only the fromString function.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
import ballerina/io;

public function main() returns error? {

    boolean t1 = check boolean:fromString("true");
    boolean f1 = check boolean:fromString("false");

    io:println("t1:", t1);
    io:println("f1:", f1);
}
t1:true
f1:false
 bal version
Ballerina 2201.6.0 (Swan Lake Update 6)
// Partial Code. Change View  to see full code.
public function main() returns error? {

    boolean t1 = check boolean:fromString("true");
    boolean f1 = check boolean:fromString("false");
}
// Highlights Only. Change View  to see full code.
boolean t1 = check boolean:fromString("true");
boolean f1 = check boolean:fromString("false");

💡 boolean is a keyword in Ballerina, and it is a pre-defined prefix. Therefore, you can call boolean functions with the prefix even without an import declaration.

 January 1, 2023

Table of Content

Key Words

Boolean Lang Library
 January 1, 2023

Table of Content

Key Words


Navigation

Site Settings

Site Theme

Source Code Density