BETA
This is a BETA experience. You may opt-out by clicking here

More From Forbes

Edit Story

What Program Did Obama Write To Kick Off Hour Of Code 2014?

Following
This article is more than 9 years old.

This question originally appeared on Quora: What was the one line JavaScript that president Obama wrote as part of the Hour of Code 2014?

Answer by Hadi Partovi, CEO, Code.org. Tech entrepreneur/investor, on Quora

It was only 2 weeks ago that I had the incredible fortune to personally ask the President of the United States to kick off the Hour of Code by trying it himself. I still can't believe it actually happened.

Many have asked me what is the code that President Obama wrote. It was a single line of JavaScript: 

moveForward(100);

That code is all it took to get Elsa to move 100 pixels to finish drawing a square, in a secret, un-released JavaScript version of our Code Studio tutorials featuring Anna and Elsa from Frozen. (see the block-based version of the tutorial at http://code.org/frozen)

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 one line to finish a square isn't hard, it's not rocket science. And that's exactly the point. That's how computer science starts. You don't write a fully-fledged game when you write your very first line of code, you write something as simple as PRINT "Hello World".

As hacker extraordinaire and Code.org spokesperson Elena Silenok famously said in the Code.org launch video, 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 

Some other more personal details:

  • The girl who taught the President to code (Adrianna)  came from an incredibly tough neighborhood in Newark that had just had a neighborhood shooting days earlier. One of the victims had been their former classmate, so she and all the kids were shaken up. This day was a total fairy-tale for them.
  • The hat the president wore is my hat. I had put it on the table next to Adrianna, and she asked him if he wanted to wear it. But he decided not to keep it, so I kept it afterwards. And now I'm deciding between wearing it every day for the rest of my life vs framing it and never wearing it again!
  • The President's opening remarks were the most amazing endorsement of our organization, he mentioned the name Code.org 3 different times! You can watch in the first video below, he says "Code.org is doing some incredible work... All across the country people are doing code," and then references our programs to collaborate with schools, etc.

P.S. It's not every day you get to take 20 students to the White House to teach the President how to code using a product your team built over the last year, to kick off a world wide campaign for your almost-2-year-old nonprofit. I mean, wow. I owe immense thanks to my team, and the support of all the partners, 75,000 teachers, and 50 million parents and students who helped make this day happen. I will remember it forever, thank you.

Videos and photos:

What was the one line JavaScript that president Obama wrote as part of the Hour of Code 2014?: originally appeared on Quora: The best answer to any question. Ask a question, get a great answer. Learn from experts and access insider knowledge. You can follow Quora on Twitter, Facebook, and Google+. More questions: