+ Start a Discussion
Louis SummersLouis Summers 

expected semi-colon found <EOF>

If you do not mind, can you please have a look at this issue?

My code is saving with no errors when saving so this is a runtime error, and I am executing in Anonymous Window the following:

AccountHandler.insertNewAccount(Acme Supply)

I am receiving the following error:
Line: 2, Column: 0  expecting a semi-colon, found '<EOF>'

There is not Line 2 in my code, and I do not know what to say about column 0.

Here is my code ( I am a newbie, trying to learn Apex)

public class AccountHandler {
       public static List<String> insertNewAccount(string nameAccount) {
                List<String> acctReturn = new List<String>();
       try {
                   Account acct = new Account(Name=nameAccount);    
                    insert acct;
        catch (DMLException e) 
                   System.debug('A DML exception has occurred: ' + e.getMessage());
        return acctReturn;
Blake TanonBlake Tanon
I don't see why you're getting that error, but your method doesn't make sense.  if you're trying to insert an account why are you returning a list of strings when you're not putting anything into that list?
Blake TanonBlake Tanon
Nevermind my first comment, i see the problem.  It's not with your class, it's with the execution of AccountHandler.insertNewAccount(Acme Supply).

You need it to be: AccountHandler.insertNewAccount('Acme Supply');