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
The WalrusThe Walrus 

Error trying first example in Apex reference manual

I'm sure it's me, but...

 

On pages 27-29 of the Apex language reference manual, there is an example that creates a custom object (Book_c and a custom field within the object Price_c).   Then,  a sample for loop within an apex class is demonstrated with the code below:

 

public class MyHelloWorld {  

    public static void applyDiscount(Book_c[] books) {

 for (Book_c  b  :books) 

 {  

   b.Price_c *= 0.9;

    }

  }

}

 

However, when I try to build this code , I get the following error:

 

Error:Compile Error: Invalid type: Book_c at line 3 column 6

 

Like I said, I'm sure it's me but...why is this not working?

 

Thanks for any assistance

Best Answer chosen by Admin (Salesforce Developers) 
The WalrusThe Walrus

Got the answer in another forum:

 

It is Book__c (two underscores)