import ballerina/io;function main (string[] args) {
    int i;
    io:println(i);    float f = 20.0;
    io:println(f);
    string s;
    io:println(s);    boolean b = true;
    io:println(b);
}

Value Types

The Ballerina type system has value types and reference types. All value typed variables are allocated on the stack. Ballerina Value types include int, float, string, boolean and blob.

import ballerina/io;
function main (string[] args) {
    int i;
    io:println(i);

Variables defined without an initial value are zero-valued. For example, the zero value for an int is 0.

    float f = 20.0;
    io:println(f);
    string s;
    io:println(s);

The default value of a string is and empty string “”.

    boolean b = true;
    io:println(b);
}
$ ballerina run value-types.bal
0
20.0
true