Using types to build applications with Ballerina
As you have already learned, Ballerina has a diverse type system that you can use to represent complex data structures and behaviors. To build a functioning application, you need to use these types. In this section, we will focus on handling program flow by using conditions and loops, using object concepts to build an object-oriented system, error handling to handle errors.
Controlling program flow
Although types provide a way to use data in the Ballerina programming language, program flow controllers provide syntax to handle the data flow in an application. Ballerina flow control is inspired by the best of other programming languages. Ballerina contains program flow controllers such as if else
, while
, foreach
, and match
. The syntaxes of these are similar to those in programming languages such as Java, C, and Go.
if else
The if else
syntax is pretty much the same as it is in other programming languages that let programs make...