Changes between Version 1 and Version 2 of Variables
- Timestamp:
- 01/16/13 00:13:48 (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Variables
v1 v2 24 24 lowercase letter (no leading underscores or punctuation). 25 25 26 They come into exist ance on first assignment unless explicitly declared26 They come into existence on first assignment unless explicitly declared 27 27 but are created local to the '''method''' they appear in (not just the block they 28 28 might have been first used in). [[BR]] … … 31 31 32 32 Local variables can be explicitly typed if desired otherwise they infer their type from the 33 type of what they are assigned from. 33 type of what they are assigned from.[[BR]] 34 If explicitly declared (or typed) they can also have the usual AccessModifiers for variables imposed on them. 34 35 35 36 {{{ … … 84 85 == Instance Variables == 85 86 86 Instance variables are variables associated with a classinstance. [[BR]]87 Instance variables are variables associated with a Type (commonly class) instance. [[BR]] 87 88 They encapsulate the state of the instance object [[BR]] 88 They must be declared (using the '''var''' keyword in a class/structure/interfacedefinition)89 They must be declared (using the '''var''' keyword in a Type (class/structure/interface) definition) 89 90 but they too can be explicitly typed or have their type inferred from being initialised in 90 91 the declaration. [[BR]] 91 Like method parameter variables, if untyped and uninitialised, their type defaults to type '''dynamic'''. 92 Like method parameter variables, if untyped and uninitialised, their type defaults to type '''dynamic'''.[[BR]] 92 93 93 94 Instance variables default to public access. [[BR]] 94 95 If named with a leading '_' they default to protected access, with double leading '_' to private access. [[BR]] 95 96 Accessibility may be explicitly specified otherwise or overridden with an 'is clause' specifying one 96 of 'public', 'protected', 'private' .97 of 'public', 'protected', 'private' as per the usual variable AccessModifiers. 97 98 98 99 {{{ … … 165 166 Method parameter variables are named the same way as local variables ( leading lowercase letter) 166 167 and are also local only to the method they are on. [[BR]] 167 Calls to the methods convey the arg s given in the call to the (formal) parameter names in the order168 Calls to the methods convey the arguments given in the call to the (formal) parameter names in the order 168 169 declared on the method for use in the called method. 169 170 … … 224 225 }}} 225 226 227 These variables can also be created subject to the usual AccessModifiers for variables. 226 228 227 229 … … 230 232 == See Also == 231 233 234 [wiki:AccessModifiers Access Modifiers] 235 232 236 233 237 [wiki:LanguageTopics Back to LanguageTopics]