Здесь вы можете использовать оператор switch (match) типа или версию выражения оператора match. Вот пример.
import ballerina/io;
function main (string... args) {
any a = "some string value";
// If the type of the variable a is string executes the first block, if not the second block.
match a {
string s => { io:println("string type");}
any k => {io:println("any other type");}
}
}
Пожалуйста, обратитесь к следующему примеру для получения дополнительной информации.
https://ballerina.io/learn/by-example/match.html