I'm new to this language and just started back at it after a few months and have a relatively basic question. I'm having some confusion understanding the arrow ->
operator in it. In the examples under Learn Ballerina By Example the basic Hello World Main
is described with the code below:
import ballerina/io;
public function main() {
io:println("Hello, World!");
}
And in the Hello Word Service
example, the code is as follows:
import ballerina/http;
import ballerina/log;
service hello on new http:Listener(9090) {
resource function sayHello(http:Caller caller, http:Request req) {
var result = caller->respond("Hello, World!");
if (result is error) {
log:printError("Error sending response", result);
}
}
}
My question lies in the Hello Word Service
program in the line
var result = caller->respond("Hello, World!");
I'm from a C/Python/Java background and arrows mean different things in each of these languages. What does it do in Ballerina specifically? I tried to look for the syntax documentation and was unsuccessful in finding it. Any link to the specific page would be helpful too.
Thanks in advance.