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
vivek ravivivek ravi 

i jus need help in for loop

List<Contact> accounts=[SELECT Email FROM Contact WHERE AccountId ='001i000000g7erl' ORDER BY Email ASC NULLS FIRST LIMIT 3];
list<Id> emailid=new list<id>();
for(id acc: Email)
{
acc.emailid[Email];
}
wat is worng in this can u explain me im new to apex code
dev_sfdc1dev_sfdc1
Hi Vivek Ravi,

Try to call query variable in for loop:

List<Contact> accounts=[SELECT Email FROM Contact WHERE AccountId ='001i000000g7erl' ORDER BY Email ASC NULLS FIRST LIMIT 3];
list<Id> emailid=new list<id>();
for(id acc: accounts)
{
acc.emailid[accounts];
}

If it resolves your problem, please hit kudos..