MCPcopy Create free account
hub / github.com/StudyRust/leetcode_rust / withdraw

Method withdraw

2043-simple-bank-system.rs:40–49  ·  view source on GitHub ↗
(&mut self, account: i32, money: i64)

Source from the content-addressed store, hash-verified

38 }
39
40 fn withdraw(&mut self, account: i32, money: i64) -> bool {
41 if self.balance.get(account as usize - 1) == None {
42 return false;
43 }
44 if self.balance[account as usize - 1] < money {
45 return false;
46 }
47 self.balance[account as usize - 1] -= money;
48 true
49 }
50}
51
52fn main() {

Callers 1

mainFunction · 0.80

Calls 1

getMethod · 0.80

Tested by

no test coverage detected