The First Piece of Code Written by an American President

The President participated in an introductory coding workshop as part of Computer Science Education Week

12_09_2014_obama coding.jpg
U.S. President Barack Obama participates in an "Hour of Code" event with middle-school students including Adrianna Mitchell in the Eisenhower Executive Office Building next to the White House in Washington, D.C. Andrew Harrer/pool/Corbis

President Obama has a way with language, and as he showed yesterday, that skill extends, ever so slightly, into the digital realm. As part of a computer programming workshop put on by Code.org, Obama punched out a bit of JavaScript code securing his place as the “first president to write a computer program,” says Wired

At an event where 20 middle school students were working away at programming tutorials put together by Code.org as part of their Hour of Code program, President Obama flitted between tutorials and photo ops before trying his hand at some light coding.

So what was the so-called 'Coder-in-Chief''s masterpiece? According to TechCrunch, “ he wrote a ranking algorithm that might just rival Larry and Sergey’s. Wait, sorry, wrong line — he wrote a little blurp of code that renders a square on the screen. Baby steps!”

In JavaScript specifically, says the Verge, the President typed out a single line—“moveForward(100);” That script caused an animated Elsa (from the movie Frozen), to slide 100 pixels to the right, said Code.org's Hadi Parvoti

Parvoti “was quick to note," says the Verge, "that 'no one starts by creating a complicated game.'”

The workshop the president attended was just one of 77,000 Hour of Code events scheduled globally for the so-called Computer Science Education Week, says CNet.

Earlier in the week U.K. Prime Minister David Cameron also tried his hand at programming. It can't be long now before the world leaders kill time trying to hack each other (by themselves, that is).

Get the latest stories in your inbox every weekday.