Prime Minister Lee Hsien Loong met Facebook founder Mark Zuckerberg at the social network's headquarters in Menlo Park, California, on Friday (Feb 12).
Mr Zuckerberg, in a Facebook post on Saturday (Feb 13), pointed out that PM Lee was "one of the only world leaders who knows how to code".
He presented PM Lee with an artwork designed at Facebook etched with lines from a computer programme Mr Lee wrote.
"Coding can be useful - no matter what your job is!" added Mr Zuckerberg.
In May last year, PM Lee shared on Facebook a Sudoku solver programme he created, adding that it was his way of championing science and technology,
PM Lee is on a week-long trip to the United States. He has met Tesla and SpaceX CEO Elon Musk, Google CEO Sundar Pichai, Alphabet executive chairman Eric Schmidt, and California Governor Jerry Brown, among others. He is also expected to meet Apple CEO Tim Cook.
After his meetings in the San Francisco area, PM Lee will head to the Sunnylands estate for a special US-Asean summit, which marks the first time the US has hosted a meeting with Asean heads of government.