Download presentation
Presentation is loading. Please wait.
Published byAleah Rufus Modified over 10 years ago
1
1 of 31 Images from Africa
2
2 of 31 My little Haitian friend Antoine (1985)
3
3 of 31 Solid Terrain Models http://www.stm-usa.com/
4
4 of 31 3D Touch Table
5
5 of 31 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
6
6 of 31 Basic C# Syntax
7
7 of 31 Comments //, ///, /* */
8
8 of 31 Declaring & Initializing variables ; = ; OR = ;
9
9 of 31 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
10
10 of 31 For real numbers …
11
11 of 31 Most commonly used types int string double bool char
12
12 of 31 Variable names & initial values = ; Variable names Cannot Be a C# keyword Begin with a number or special char except _ and @ Contain numbers and chars (-, ', etc) Should Be camelCase Describe the content Initial values 0 for numbers or what makes sense for app string.Empty / "" for strings, etc.
13
13 of 31 Expressions = Output z = ++x // z assigned value x + 1 z = x++ // z assigned value of x before x is incremented
14
14 of 31 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
15
15 of 31 Boolean Logic
16
16 of 31 Branching with if
17
17 of 31 Branching with switch
18
18 of 31 Looping with for
19
19 of 31 Looping with while If condition is false, while is not executed at all.
20
20 of 31 Looping with do Executed once before condition is checked
21
21 of 31 Interrupting loops break Exit from loop continue Return to top of loop return Exit from loop & containing function
22
22 of 31 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
23
23 of 31 Advanced types – enum To constrain the possible values for a variable Declared at same level as class Plain text names associated with number
24
24 of 31 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
25
25 of 31 Advanced types – Array Making it easier to create/access groups of values of the same type
26
26 of 31 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
27
27 of 31 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
28
28 of 31 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.
29
29 of 31 Params by ref and by value
30
30 of 31 Variable Scope
31
31 of 31 Funny if it wasn’t true air transat ad My version
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.