1 / 118

http:// proglit.com /

http:// proglit.com /. a first language. SA. BY. pigeon. (a “fake” language). source code. (code as text). comment. this is code # this is a comment. value. (a piece of data). d ata types. number string boolean. number. 3 -724 8.93 -0.88881. string. (a piece of text)

mira
Download Presentation

http:// proglit.com /

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. http://proglit.com/

  2. a first language

  3. SA BY

  4. pigeon (a “fake” language)

  5. source code (code as text)

  6. comment this is code # this is a comment

  7. value (a piece of data)

  8. data types number string boolean

  9. number 3 -724 8.93 -0.88881

  10. string (a piece of text) “R. Nixon” “T” “Elementary, my dear Watson.” “%”

  11. boolean (a true/false value) true false

  12. null (a value representing nothing) null

  13. literal (a value written in code) null “The owls are not what they seem.” 78 false

  14. escape sequence “\”Hi,\” she said.” “Hello,\nworld.” “c:\\bla\\bla\\bla”

  15. operation (takes input values and returns an output value)

  16. operator operand (specifier of the operation to perform) (an input value)

  17. (3+5) (+35)

  18. (3+5)(add35)

  19. 3+5+-7+11(add35-711)

  20. 11-2*311- (2*3)(sub11 (mul23))

  21. variable (a memory location holding a value)

  22. identifier (a name) NewYork foo asdf43qwerty78 illegal: New York f^$o*o 43asdf

  23. case sensitive (letter case matters) NewYork newyork newYORK nEwYoRk NEWYORK

  24. reserved word (an identifier reserved by the language) add, sub, mul, div, if, while…

  25. assignment asdogtrue asnewt -87.2 asbirdnull ascat“rubber baby buggy bumper” (gives a variable a value)

  26. asbar19 asfoobar asbar3 asfizz(addfoo11)

  27. expression (evaluates into a value) null (addfoo2) “hello” bar

  28. statement (the units of syntax that make up the code) asfoo53 (addfoo11)

  29. computer (a cpu, memory, and i/o)

  30. cpu (executes instructions)

  31. memory (holds bits)

  32. i/o (input/output)

  33. print (display a value on the screen) (print“wakka wakka”) asbar19 (printbar)

  34. prompt (return typed input from user) asfoo (prompt) (printfoo)

  35. Hello, world! (print“Hello, world!”)

  36. eq (eq“moo” “moo” “moo”) # true (eq-35 -35) # true (eq6 2) # false (equality test)

  37. not (reverse the truth value) (nottrue) # false (notfalse) # true

  38. conditional execution • (maybe do something, or maybe skip over it)

  39. if (“run these statements if…”) ifcondition body

  40. if (eqx3) (print“cat”) (print“dog”) (print“bird”) x equals 3 cat dog bird x doesn’t equal 3 bird

  41. mutual exclusion • (do one thing or do the other, but NOT both)

  42. if (eqx3) (print“hi”) if (not (eqx3)) (print“bye”) x equals 3 hi x doesn’t equal 3 bye

  43. else ifcondition body1 else body2 (“…elsewise, run these other statements”)

  44. if (eqx3) (print“hi”) else (print“bye”) x equals 3 hi x doesn’t equal 3 bye

  45. if (eqx3) (print“hi”) else if (eqx5) (print“bye”) x equals 3 hi x equals 5  bye x doesn’t equal 3 or 5 

  46. elif ifcondition1 body1 elif condition2 body2 (a convenience for else if)

  47. if (eqx3) (print“hi”) elif (eqx5) (print“bye”) x equals 3 hi x equals 5  bye x doesn’t equal 3 or 5 

  48. if (eqx3) (print“hi”) elif (eqx5) (print“bye”) elif (eqx-7) (print“moo”) elif (eqx14) (print“woof”) x equals 3 hi x equals 5  bye x equals -7  moo x equals 14  woof x doesn’t equal any of these values 

  49. if (eqx3) (print“hi”) elif (eqx5) (print“bye”) elif (eqx-7) (print“moo”) else (print“meow”) x equals 3 hi x equals 5  bye x equals -7  moo x doesn’t equal any of these values  meow

More Related