Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 of 32 Images from Africa. 2 of 32 My little Haitian friend Antoine (1985)

Similar presentations


Presentation on theme: "1 of 32 Images from Africa. 2 of 32 My little Haitian friend Antoine (1985)"— Presentation transcript:

1 1 of 32 Images from Africa

2 2 of 32 My little Haitian friend Antoine (1985)

3 3 of 32 Solid Terrain Models http://www.stm-usa.com/

4 4 of 32 3D Touch Table

5 5 of 32

6 6 of 32 Overview Variables & Expressions Basic C# Syntax Comments Declaring & initializing variables Flow control Boolean logic Branching & looping Advanced types enum, struct, Array Type conversions Functions Variable scope

7 7 of 32 Basic C# Syntax

8 8 of 32 Comments //, ///, /* */

9 9 of 32 Declaring & Initializing variables ; = ; OR = ;

10 10 of 32 Types – esp. Value Apart from bool, char, & enum, value types have a range of numbers they support (p. 37) TypeRange byte0 to 255 sbyte-128 to 127 short-32768 to 32767 int-2147483648 to 2147483647

11 11 of 32 For real numbers …

12 12 of 32 Most commonly used types int string double bool char

13 13 of 32 Variable names & initial values = ; Variable names Cannot Be a C# keyword Begin with a number or special char except _ and @ Contain chars like -, ‘, etc) Should Be camelCase Describe the content Initial values 0 for numbers or what makes sense for app string.Empty / “” for strings, etc.

14 14 of 32 Expressions = // x = x + 1, z = x + 1 // x = x + 1, z = x // x = x - 1, z = x – 1 // x = x - 1, z = x p. 46, 47 in Watson et al. ++x add before expression evaluated x++ add after expression evaluated

15 15 of 32 Overview Variables & Expressions Basic C# Syntax Comments Declaring & initializing variables Flow control Boolean logic Branching & looping Advanced types enum, struct, Array Type conversions Functions Variable scope

16 16 of 32 Boolean Logic

17 17 of 32 Branching with if

18 18 of 32 Branching with switch

19 19 of 32 Looping with for

20 20 of 32 Looping with while

21 21 of 32 Looping with do

22 22 of 32 Interrupting loops break Exit from loop continue Return to top of loop return Exit from loop & containing function

23 23 of 32 Overview Variables & Expressions Basic C# Syntax Comments Declaring & initializing variables Flow control Boolean logic Branching & looping Advanced types enum, struct, Array Type conversions Functions Variable scope

24 24 of 32 Advanced types – enum To constrain the possible values for a variable Declared at same level as class Plain text names associated with number

25 25 of 32 Advanced types – struct A custom, multi-valued, type that can have functions Declared at same level as class Can contain value types (int, long, double, etc) and strings

26 26 of 32 Advanced types – Array Making it easier to create/access groups of values of the same type

27 27 of 32 Overview Variables & Expressions Basic C# Syntax Comments Declaring & initializing variables Flow control Boolean logic Branching & looping Advanced types enum, struct, Array Type conversions Functions Variable scope

28 28 of 32 Type conversions Types with smaller range can be implicitly converted to types with larger range Other types MAY be explicitly converted target_type outvar = (target_type) variableName

29 29 of 32 Functions: Defining and calling Syntax for defining functions: [ scope] [static] return_type name ([params]) { // C# statements [return [return_value]]; } 0 or more params are declared like variables and comma separated.

30 30 of 32 Params by ref and by value

31 31 of 32 Variable Scope

32 32 of 32 Funny if it wasn’t true Air Transat ad My version


Download ppt "1 of 32 Images from Africa. 2 of 32 My little Haitian friend Antoine (1985)"

Similar presentations


Ads by Google