Mark Zuckerberg admits he misses his coding days

Mark Zuckerberg visits Nigeria
Mark Zuckerberg visits Nigeria

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 also admitted 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.

Related: Nigeria slumps into recession over low oil prices

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.

mark zuckerberg facebook african nigeria
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.

Zuckerberg has been increasingly involved in African initiatives this year. In June, his foundation -- the Chan Zuckerberg Initiative -- made a multi-million dollar investment in Andela, a two-year-old startup that trains African software developers and gives them full-time roles at international companies.

Zuckerberg has also put his weight behind a program called "Free Basics," which provides free internet access to cellphone users in under-served countries, including Zambia, Tanzania and Kenya.

It runs in more than 20 African countries and recently launched in Nigeria.

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.

CNNMoney Sponsors