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
Pradeep Pradhan 21Pradeep Pradhan 21 

Write apex code to store Record ids in set and display them. (use Contact object)

AnkaiahAnkaiah (Salesforce Developers) 
Hi Pradeep,

Try with below code in developer console.
Set<id> contactids = new set<id>();

List<contact> listcons = [select id,name from contact];

for(contact con:listcons ){

contactids.add(con.id);
}

system.debug('contactids '+contactids );

If this helps, please mark it as best answer.

Thanks!!