• Octavian-Teodor Axinte
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
Hello Friends,

I was going through the trailhead and happened to execute the below code:

public static void updateOlderAccounts() {
    // Get the 5 oldest accounts
    Account[] oldAccounts = [SELECT Id, Description FROM Account ORDER BY CreatedDate ASC LIMIT 5];
    // loop through them and update the Description field
    for (Account acct : oldAccounts) {
        acct.Description = 'Heritage Account';
   }
   // save the change you made
   update oldAccounts;
}


But its showing error on line 1 - unexpected token: 'void'

Can anyone please help?

Thanks in advance!