President Barack Obama told the world that everyone should learn how to code. And now he's putting his money where his mouth is.

Earlier today, to help kick-off the annual Computer Science Education Week, Obama became the first president ever to write a computer program. It was a very simple program—all it does is draw a square on a screen—but that's the point, says Hadi Partovi, co-founder Code.org, an organization that promotes computer science education. "All programming starts simple," he says. "No one starts by creating a complicated game."

Last year, Obama delivered a YouTube speech to promote Computer Science Education Week, but didn't write any code himself. "Learning these skills isn’t just important for your future. It’s important for our country’s future,” the president said in the – video. "If we want America to stay on the cutting edge, we need young Americans like you to master the tools and technology that will change the way we do just about everything."

Obama was echoing the sentiment of the growing code literacy movement, which seeks to expand computer science and programming education throughout the world. Code literacy advocates argue that with information technology embedding itself ever deeper into our lives, everyone should learn a bit more about how computers operate. A whole industry has sprung-up around the idea, with companies offering everything from children's games that teach the fundamentals of programming to intensive three month full-time "bootcamps" dedicated to teaching people how to code well enough to land a job.

Code.org introduced the "Hour of Code" campaign last year with the aim of convincing all students to try just one hour of programming and showing them that anyone can learn the basics. As part of the campaign, the organization created a website that compiles many different hour long tutorials, most of which were created specifically for the campaign.

Obama wrote his code part of event today organized by Code.org, which brought brought 20 middle school students from the South Seventeenth Street School in Newark, New Jersey, to the White House, where they met the president and worked on Hour of Code tutorials. Partovi says the president himself didn't complete the tutorial from start to finish, but instead went from station to station watching the students work. He did, however, complete some of the exercises, which involved both using Google's Blockly tool, and writing a line of code using the programming language JavaScript.

Obama joins New York City Mayor Michael Bloomberg, who tweeted in 2012 that his New Year's resolution was to learn to code, among major U.S. politicians who have taken the first steps towards code literacy.