From a7c95baaa160e6bab72a941f9b8cc7b2c4a54b39 Mon Sep 17 00:00:00 2001 From: adibmbrk Date: Thu, 4 Jul 2024 19:15:29 +0530 Subject: [PATCH] Convert construct message to a query expression --- examples/AutomatedSummaryReport/main.bal | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/examples/AutomatedSummaryReport/main.bal b/examples/AutomatedSummaryReport/main.bal index a8d647b..14d0ccc 100644 --- a/examples/AutomatedSummaryReport/main.bal +++ b/examples/AutomatedSummaryReport/main.bal @@ -53,12 +53,10 @@ public function main() returns error? { } // Construct the stand-up report message - string textMessage = "Automated Stand Up Report: "; - int i = 1; - foreach string text in latestText { - textMessage += string `${i}. ${text}\n`; - i += 1; - } + string textMessage = string `Automated Stand Up Report: ${"\n"}${ + from [int, string] [index, text] in latestText.enumerate() + select string `${index + 1}. ${text}${"\n"}` + }`; // Post the stand-up report message to the "general" channel json postMessageResult = check slack->/chat\.postMessage.post({channel: "general", text: textMessage});