type account = { mutable balance : int }

exception Insufficient

let withdraw acct amt =
  if amt > acct.balance then raise Insufficient
  else acct.balance <- acct.balance - amt

let deposit acct amt = acct.balance <- acct.balance + amt

;;

let a = { balance = 100 } in
deposit a 50;
withdraw a 30;
try (withdraw a 200; -1)
with Insufficient -> a.balance
