Syntax error that does not make sense.

Syntax error that does not make sense.

Hi all,

I cannot fingure out where this syntax error is coming from. I need to add this to a workflow to update a Contact record Account field by matching the email domain with the website domain in the Account record. I found a solution using Zia Search but Compliance does not allow the use of AI where customer data is involved. 

  1. void automation.AssociateContactsAccounts(int contactId) {
  2.           try {
  3.           contactRecord = zoho.crm.getRecordById("Contacts", contactId);
  4.         if (contactRecord == null) {
  5.             info "Contact record not found for ID: " + contactId;
  6.             return;
  7.         }

  8.         contactEmail = contactRecord.get("Email");

  9.         if (contactEmail != null && contactEmail.contains("@")) {
  10.             emailDomain = contactEmail.split("@").get(1).toLowerCase(); 

  11.             page = 1;
  12.             accountsFound = false;

  13.             while (accountsFound == false) {
  14.                 accounts = zoho.crm.getRecords("Accounts", page, 500); 
  15.                 if (accounts.isEmpty()) {
  16.                     break; 
  17.                 }

  18.                 for each account in accounts {
  19.                     accountWebsite = account.get("Website");

  20.                     if (accountWebsite != null && accountWebsite != "") {
  21.                         cleanDomain = accountWebsite.toLowerCase()
  22.                             .replace("http://", "")
  23.                             .replace("https://", "")
  24.                             .replace("www", "")
  25.                             .split("/").get(0);

  26.                         if (cleanDomain == emailDomain) {
  27.                             accountId = account.get("id");
  28.                             updateMap = Map();
  29.                             updateMap.put("Account_Name", accountId);
  30.                             response = zoho.crm.updateRecord("Contacts", contactId, updateMap);

  31.                             info "Contact linked to Account successfully: " + response;
  32.                             accountsFound = true;
  33.                             break;
  34.                         }
  35.                     }
  36.                 }
  37.                 page = page + 1;
  38.             }

  39.             if (accountsFound == false) {
  40.                 info "No matching Account found for email domain: " + emailDomain + " for Contact ID: " + contactId;
  41.             }
  42.         } else {
  43.             info "Invalid or missing Email for Contact ID: " + contactId;
  44.         }
  45.     } catch (e) {
  46.         info "Error in AssociateContactsAccounts: " + e.toString();
  47.     }
  48. }


 Failed to update function Syntax error. Expecting ';'. Found '{'. (Line : 17)

I am very new at this is its prabably dumb but I am not seeing it... 

Any guidance would be appreciated.