Wednesday, January 29, 2014

Lesson 48 - Variables and Vim

When I came home from work today, the first thing she said was "Let's have a coding lesson". So we started by opening our web page in the browser, using the command-line, of course: open index.html. This is honestly the fastest way I know. Then I told her to open the secret drawer and she pressed Cmd-Alt-J without hesitation.

Then we opened the Javascript file game.js in vim and started coding. She didn't remember the var keyword but with a little tips here and there, she produced this.



And when I suggested that we call the tell function and give it two things (some text plus the variable p) she quickly amended

    tell("pinsesa",p)

Exit insert mode, save etc. Then back to the browser. And it worked. The program printed the word "pinsesa" (almost prinsessa) and the value of the variable p on the page.

That was enough for today. She created her first Javascript file and ran it in the browser. Not bad!

No comments:

Post a Comment