import ballerina/io;
function main (string[] args) { worker w1 {
io:println("Hello, World! #m");
} worker w2 {
io:println("Hello, World! #n");
} worker w3 {
io:println("Hello, World! #k");
}
}
Hello World ParallelLet's print "Hello, World!" in parallel using Ballerina. Here we use workers which represent parallel threads of execution in Ballerina. |
|
import ballerina/io;
|
|
function main (string[] args) {
|
Workers don’t need to be explicitly started. They start at the same time as the default worker. |
worker w1 {
io:println("Hello, World! #m");
}
|
|
worker w2 {
io:println("Hello, World! #n");
}
|
|
worker w3 {
io:println("Hello, World! #k");
}
}
|
|
$ ballerina run hello-world-parallel.bal
Hello, World! #m
Hello, World! #k
Hello, World! #n
|
|