function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Michael Bulnes 1Michael Bulnes 1 

Error: Compile Error: expecting an equals sign, found '1' at line 2 column 14

I was doing a APEX Tutorial and my first task was to write a trigger using my Salesforce Developer Org and received the following error:

Error: Compile Error: expecting an equals sign, found '1' at line 2 column 14

Any ideas would be appreciated.

[Hello World Trigger]

trigger HelloWorld on Lead (before update) {
    for (Lead 1 : Trigger.new) {
        1.FirstName = 'Hello';
        1.LastName = 'World';
    }
}
Terence_ChiuTerence_Chiu
Replace 1 with another variable name like lead1.
trigger HelloWorld on Lead (before update) {
    for (Lead lead1 : Trigger.new) {
        lead1.FirstName = 'Hello';
        lead1.LastName = 'World';
    }
}

 
Michael Bulnes 1Michael Bulnes 1
Thank you Terence.  It worked great!