Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
complexvalues [2019/01/04 16:50]
christian [Anatomy of a Value]
complexvalues [2019/01/04 16:56]
christian [Using Values]
Line 38: Line 38:
 </code> </code>
  
-Withit you can:+With it you can:
   * create a value with <code smalltalk>person := Person example</code>   * create a value with <code smalltalk>person := Person example</code>
   * ask for its parts <code smalltalk>person name  "returns 'Christian Haider' "</code>   * ask for its parts <code smalltalk>person name  "returns 'Christian Haider' "</code>
Line 132: Line 132:
 </code> </code>
  
-After generating code with: <code smalltalk>Person generateMethods</code>our example responds to #nickname :+After generating code with:  
 +<code smalltalk>Person generateMethods</code> 
 +our example responds to #nickname :
  
 <code smalltalk> <code smalltalk>
Line 142: Line 144:
 Person class>>name: nameString sex: sexSymbol birthday: birthdayDate nickname: nicknameString> Person class>>name: nameString sex: sexSymbol birthday: birthdayDate nickname: nicknameString>
 </code> </code>
 +
 +Now you can specify a nickname:
 +<code smalltalk>
 +Person name: 'Christian Haider' sex: #male birthday: (Date d: 25 m: 6 y: 1960) nickname: 'Chris'>
 +</code>
 +
 +If you use the same parameter as the default, it is ignored
 +<code smalltalk>
 +Person name: 'Christian Haider' sex: #male birthday: (Date d: 25 m: 6 y: 1960) nickname: 'Christian Haider'>
 +</code>
 +because it is equal to
 +<code smalltalk>
 +Person name: 'Christian Haider' sex: #male birthday: (Date d: 25 m: 6 y: 1960)>
 +</code>
 +
  
 ==== Get it ==== ==== Get it ====
  • complexvalues.txt
  • Last modified: 2022/03/06 08:57
  • by christian