Changes between Version 3 and Version 4 of NilableTypes
- Timestamp:
- 11/22/10 20:05:33 (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
NilableTypes
v3 v4 11 11 e.g. 12 12 {{{ 13 #!cobra 13 14 str as String = "Mystring" # str can only have a String value 14 15 strN as String? # strN may have a String value OR nil … … 20 21 21 22 {{{ 23 #!cobra 22 24 def sendWelcome(cust as Customer, referral as Customer?) 23 25 # will not accept nil for `cust` … … 39 41 e.g. 40 42 {{{ 43 #!cobra 41 44 s as String = 'a string' 42 45 sn = s to ? # sn is String? … … 49 52 You can explicitly test for nil or not nil values using normal conditionals (true is non-nil) 50 53 {{{ 54 #!cobra 51 55 s as String = 'sss' 52 56 assert s … … 69 73 '''a ! b ''' evaluate b if a not nil. 70 74 {{{ 75 #!cobra 71 76 stuff as String? = nil 72 77 defaultStuff='DEFAULT'