November 2018
Intermediate to advanced
390 pages
10h 8m
English
Similar to other programming languages, Ballerina has control logic statements, such as the C programming language, and these are very simple. The available control statements are as follows:
The following code shows an example using while that will run this loop twice and print an i value:
//while example while (i < 2) {
io:println(i);
i = i + 1;
}//Output:1
The following code is an example using the if ... else if ... else statement. It will print values according to the provided value of b. For example, if you set b=2, it will print b > 0:
// if ..else if..else exampleif (b < 0) { io:println("b < 0"); } else if (b > 0) { io:println("b > 0"); } else ...Read now
Unlock full access