Changes between Version 8 and Version 9 of AllOfCobraInOnePage
- Timestamp:
- 01/06/14 12:24:45 (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
AllOfCobraInOnePage
v8 v9 71 71 }}} 72 72 73 74 mixin example: 75 {{{ 76 77 mixin VolumeSupport 78 pro volume from var as int 79 def decVolume 80 .volume = Math.max(0, .volume - 1) 81 82 def incVolume 83 .volume = Math.min(100, .volume + 1) 84 85 }}} 86 {{{ 87 class Radio adds VolumeSupport 88 cue init 89 base.init 90 .volume = 0 91 92 }}} 93 {{{ 94 class TV adds VolumeSupport 95 cue init 96 base.init 97 .volume = 0 98 }}} 99 {{{ 100 class Program 101 def main 102 r = Radio() 103 assert r.volume == 0 104 r.incVolume 105 assert r.volume == 1 106 107 }}}