Code flow: Difference between revisions

From XPUB & Lens-Based wiki
(Created page with "<slidy theme="aa" /> == Code == http://rosettacode.org/wiki/Category:Draft_Programming_Tasks http://rosettacode.org/wiki/99_Bottles_of_Beer == Expression / Evaluation == So...")
 
No edit summary
Line 1: Line 1:
<slidy theme="aa" />
<slidy theme="aa" />


== A Computer Glossary ==
Charles & Ray Eames 1968
Produced for the IBM Corporation pavilion at Hemisfair, the 1968 Worlds Fair in San Antonio, Texas.


== Code ==
== Code ==
Line 23: Line 28:


  5 * 3
  5 * 3
100 - 1
3 * 8


  "Tristram" + "Shandy"
  "Tristram" + "Shandy"


== Operations: Functions ==
Math.sqrt (25)
Math.sqrt (26)
== Objects ==
"Tristram".toUpperCase
?!
"Tristram".toUpperCase()


== Assignment ==
== Assignment ==
Line 44: Line 66:


  name = name + " Shandy"
  name = name + " Shandy"
== DOM ==
== A Script ==


== BASIC ==
== BASIC ==
Line 68: Line 95:
http://en.wikipedia.org/wiki/Conditional_jump
http://en.wikipedia.org/wiki/Conditional_jump


== DOM ==
== If-Then ==
 
== A Script ==


== Function / Callback ==
== Function / Callback ==

Revision as of 11:15, 24 September 2012

<slidy theme="aa" />

A Computer Glossary

Charles & Ray Eames 1968

Produced for the IBM Corporation pavilion at Hemisfair, the 1968 Worlds Fair in San Antonio, Texas.

Code

http://rosettacode.org/wiki/Category:Draft_Programming_Tasks

http://rosettacode.org/wiki/99_Bottles_of_Beer

Expression / Evaluation

Some expressions for the console...

5
3
"Tristram"
'SHAndy'

Operations

5 * 3
100 - 1
3 * 8
"Tristram" + "Shandy"

Operations: Functions

Math.sqrt (25)
Math.sqrt (26)

Objects

"Tristram".toUpperCase

?!

"Tristram".toUpperCase()

Assignment

Assignment is the process of storing an expression in a "name", called a variable.

x = 5 * 3
name = "Tristram"

Assignment ++

x = x + 1
x += 1
x++
name = name + " Shandy"

DOM

A Script

BASIC

10 INPUT "What is your name: ", U$
20 PRINT "Hello "; U$
30 INPUT "How many stars do you want: ", N
40 S$ = ""
50 FOR I = 1 TO N
60 S$ = S$ + "*"
70 NEXT I
80 PRINT S$
90 INPUT "Do you want more stars? ", A$
100 IF LEN(A$) = 0 THEN GOTO 90
110 A$ = LEFT$(A$, 1)
120 IF A$ = "Y" OR A$ = "y" THEN GOTO 30
130 PRINT "Goodbye "; U$
140 END

from wikipedia:BASIC

Branch

http://en.wikipedia.org/wiki/Conditional_jump

If-Then

Function / Callback

Exercise: Canvas

Handouts

Assignment, GeneralImperative + ProgramHighLow

Debug / Trace

Scope

Loop

Afternoon: Image Manipulation

The CanvasPixelArray contains height x width x 4 bytes of data, with index values ranging from 0 to (height x width x 4)-1.

context.getImageData

context.putImageData

! Come up with examples showing variable scope.