Mark Zuckerberg admits he misses his coding days

Facebook founder Mark Zuckerberg misses his days as an engineer and coder.

While the 32-year-old billionaire tech CEO was visiting Nigeria this week, he spoke publicly about how he applied his engineering mindset to help build Facebook(FB), a company that's now worth north of $360 billion. But he alsoadmitted giving up coding to manage his company was "a little sad".

"There is an elegance to writing code that I miss," Zuckerberg said during a Q&A session with tech entrepreneurs and developers in Lagos, Nigeria. "The code always does what you want -- and people don't."

His comments were met with a laugh from the crowd. But he quickly pointed out that people can surprise you by going above and beyond expectations, too.

Zuckerberg arrived in Nigeria on Tuesday, making this his first-ever trip to Sub-Saharan Africa. His goal is to learn how to "better support tech development and entrepreneurship across Africa," according to a statement from the company.

Zuckerberg explained to the crowd that his engineering background helped to grow the company because he often broke down big problems into small steps. This applied to everything from writing code and hiring people to managing teams.

Facebook founder Mark Zuckerberg is in the midst of his first-ever visit to Nigeria.

His visit included a trip to a Yaba, known as the Silicon Valley of Nigeria, where he toured a coding camp for kids and met with about 50 local startup founders and developers at CcHub, a local innovation center.

The "Free Basics" app -- which is run by Facebook's Internet.org unit -- allows cellphone users to access certain types of information related to topics like health care and employment with some limitations to the content users can see.