Tuesday, October 19, 2021

Binding Patterns in Ballerina

The term "binding pattern" in Ballerina denotes a way of allowing different parts of a single structured value to have each of its parts assigned to separate variables at the same time given that all variables in the binding pattern are distinct. The concept of binding patterns makes it easier to extract information, especially from structured values in a much cleaner way. 

Shown below is a typical example of a binding pattern where fields name and age of the Person type record named tom are being matched and assigned to variables named firstName and personAge.



from DZone.com Feed https://ift.tt/3AWXFv6

No comments:

Post a Comment