Presentation is loading. Please wait.

Presentation is loading. Please wait.

Punctuator & Delimiter

Similar presentations


Presentation on theme: "Punctuator & Delimiter"— Presentation transcript:

1

2 Punctuator & Delimiter

3

4

5

6

7

8 If we human misunderstand without correct punctuation
What makes we think that computer can understand without it?

9 These things may look pretty, but they are not decorative items…
… to be placed anywhere & anytime we want to our whim

10 Example for C++ Mathematica punctuators are different but with similar concepts

11

12 Square brackets Plot[input], myfunc[input] type myfunc(input)
Sturdy, rigid form for indication of function bracketing function input Plot[input], myfunc[input] type myfunc(input) Compared with C/C++ CAPITAL for functions in Mathematica, different from lowercase for keywords and function in C/C++

13

14 Curly brackets type xarr[3]= {a,b,c} mylist={item1, item2,}
Flexible form group items, objects together in a list, array mylist={item1, item2,} type xarr[3]= {a,b,c} Compared with C/C++ Graphics[{item1, item2,…}, option]

15

16

17 Optional for Mathematica
can be used to group related items avoid if not useful and potentially confusing with nearby lists

18 The empty refrigerator rule for both [] and {}
If you open a bracket , brace, or parenthesis, like a refrigerator, close it even if it is empty myfunc[] Open and close immediately, even if you don’t know what to put inside. mylist={} Manipulate[ ,{} ] Graphics[{},]

19 Keyboard habits Highly recommended
Open and close with successive keystrokes using adjacent fingers – with or without shift. Highly recommended

20

21

22 Comma mylist={item1,item2,} Graphics[{item1,item2,…}, option1
A pause, to delimit one item from another a space in Mathematica is a multiplier * the wicked comma is morally, ethic'lly, spiritually, physically, positively, absolutely, undeniably reliably needed, and it's not only merely needed, it’s really most sincerely needed. mylist={item1,item2,} Graphics[{item1,item2,…}, option1 , option2, …]

23 executable statement or object definition ; executable statement … ;
Manipulate[ executable statement or object definition ; executable statement … ; {item1,item2, …} , option1 , option2 , …] display output

24

25

26

27 Semicolon in C/C++, it terminates an executable statement or a declaration same in Mathematica never to be confused or mixed up where comma is needed it is necessary and sufficient in most cases, rarely it is superfluous

28 executable statement or object definition ; executable statement … ;
without it, Mathematica will multiply two statements together Manipulate[ executable statement or object definition ; executable statement … ; {item1,item2,} , option1 , option2 , …] display output

29

30 , (else) If[ condition , (then) executable statement … ; … ];
Curly braces are optional optional (C/C++ uses curly braces for block separation)

31 Is it necessary and sufficient?


Download ppt "Punctuator & Delimiter"

Similar presentations


Ads by Google