Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to touchdevelop values … and types Disclaimer: This document is provided “as-is”. Information and views expressed in this document, including.

Similar presentations


Presentation on theme: "Introduction to touchdevelop values … and types Disclaimer: This document is provided “as-is”. Information and views expressed in this document, including."— Presentation transcript:

1 introduction to touchdevelop values … and types Disclaimer: This document is provided “as-is”. Information and views expressed in this document, including URL and other Internet Web site references, may change without notice. You bear the risk of using it. This document does not provide you with any legal rights to any intellectual property in any Microsoft product. You may copy and use this document for your internal, reference purposes. © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and Windows Live are trademarks of the Microsoft group of companies. All other trademarks are property of their respective owners.

2 introduction to touchdevelop basic value types o Boolean true, false o Number IEEE floating point numbers, double precision o String there is no separate character type, consider using strings of length 1 o DateTime date + time

3 introduction to touchdevelop other types o All other types have “reference semantics” Values of all other types are references to actual data Copying values only copies references, not actual data o Examples: Song, Picture, … all collection types

4 introduction to touchdevelop ‘invalid’ o All types have an ‘invalid’ value Including Boolean, Number, String, DateTime For numbers, ‘invalid’ is different from NaN o To check if a value is null, use value→is invalid o To get an invalid value of a type, use invalid→[type name]

5 introduction to touchdevelop ‘invalid’ example var x := senses→current location if x→is invalid then “GPS not working”→post to wall time→stop

6 introduction to touchdevelop ‘invalid’ example var last := invalid→sprite for each current in my sprite set do if not last→is invalid then last→hide last := current current→show board→update on wall

7 introduction to touchdevelop collection types o there are many useful collection types o to create a new instance, use collections→create [collection type] o example: var c = collections→create location collection

8 introduction to touchdevelop special collections o number map mapping of Numbers to Numbers keys can be numbers different from 0, 1, 2, … ‘post to wall’ prints a chart o sprite set think of a simple “sprite collection” however, it is created from and belongs to a particular ‘board’

9 introduction to touchdevelop initial values o local variables get initial value from assignment expression example: x := 1 o parameters get initial value from calling context o returns are initially ‘invalid’ o global variables ( data) most are initially ‘invalid’ (!) however: Number: 0, Boolean: false, String: “”, Date: 1/1/0001

10 introduction to touchdevelop title o item 1 o item 2 song→post to wall ☀ anecdote ☁ http://touchdevelop.com/velk (link to sample)http://touchdevelop.com/velk ► an exercise ✿ a reference


Download ppt "Introduction to touchdevelop values … and types Disclaimer: This document is provided “as-is”. Information and views expressed in this document, including."

Similar presentations


Ads by Google