Bank account - GoldenScheme - Scheme on JavaScript

Result:

Source:
(begin 
  (define bank-account 
    (let ((amount 1000)) 
      (lambda (n) (set! amount (+ amount n)) amount)
    )
  )
  (bank-account 2000) 
  (bank-account -2500)
)
Home