fork download
  1. "| library book1 book2 checkoutAction |
  2.  
  3. book1 := Dictionary new at: #title put: 'BookA'; at: #available put: true; yourself.
  4. book2 := Dictionary new at: #title put: 'BookB'; at: #available put: true; yourself.
  5.  
  6. library := OrderedCollection with: book1 with: book2.
  7.  
  8. checkoutAction := [:aLibrary :aTitle |
  9.   | book |
  10.   book := aLibrary detect: [:b | (b at: #title) = aTitle] ifNone: [nil].
  11.   (book notNil and: [book at: #available])
  12.   ifTrue: [
  13.   book at: #available put: false.
  14.   Transcript show: 'Success: ', aTitle, ' checked out.'; cr.]
  15.   ifFalse: [
  16.   Transcript show: 'Failed: ', aTitle, ' not available.'; cr.]
  17. ].
  18.  
  19. checkoutAction value: library value: 'BookA'.
  20. checkoutAction value: library value: 'BookA'.your code goes here"
Success #stdin #stdout 0.01s 7756KB
stdin
Standard input is empty
stdout
Standard output is empty