Leave a comment

Obama wrote a line of JavaScript code yesterday

Obama wrote a line of JavaScript code yesterday
Ali Partovi/Facebook

The Commander-in-Chief is now the Coder-in-Chief. President Obama became the first sitting president to write a computer program in office. Maybe we should start calling it the "executable branch!" I kid.

But you might be asking yourself, why is President Obama writing computer code?

It's Computer Science Education Week, of course! And within Computer Science Education Week, there's the Hour of Code, where people can try out one hour of programming to learn the basics.

Obama decided to get a little bit more hands-on this year versus last, writing a simple computer program that draws a square on a screen. That's it. He used Google's Blockly tool and wrote his code using JavaScript.

It doesn't seem like much, but Code.org's co-founder Hadi Partovi says:

"It was a very simple program—all it does is draw a square on a screen—but that’s the point ... All programming starts simple. No one starts by creating a complicated game.”

And for those who want to know more about the actual code itself, Partovi outlined it on his Facebook page:

Hadi Partovi Facebook

It reads:

For those who asked what is the code that President Obama wrote it was a single line of JavaScript: moveForward(100);

That line was what it took to get Elsa to move 100 pixels to finish drawing a square, in a soon-to-be-released JavaScript version of our Code Studio. The President asked if he needs to type the F in upper-case, and he got the () and the ; right too, he was very precise and didn't make a typing mistake.

Drawing a single line to finish a square isn't hard, it's not rocket science. but that's EXACTLY the point. That's how computer science starts. You don't write a fully-fledged game when you write your first line of code, you write PRINT "Hello Word" As hacker extraordinaire and Code.org spokesperson Elena Silenok famously said, her first code was to draw a red circle and a green square. Computer science is about starting small, learning how to tell the computer to do the simplest, easiest thing and then building from there. It all starts with a first line of code. #HourOfCode #moveForward

Last year in the hour of code, thousands of students signed up and learned how to make apps, programmed games and learned many other valuable skills. Obama didn't write any code himself, but this year, he decided to get more hands-on.

Watch Obama's YouTube speech below to see what else he has to say about Computer Science Education Week and the Hour of Code.

Next Story
Source: Wired
View Comments ()
ATM wiretapping: Look for these tamper signs before you use ATMs
Previous Happening Now

ATM wiretapping: Look for these tamper signs before you use ATMs

Haggle for better prices on Amazon
Next Happening Now

Haggle for better prices on Amazon