Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Deposit and Withdraw with float64
package main
import (
var balance float64 = 0
func main() {
if balance, ok := withdraw(0.30000000000000004); ok {
func deposit(v float64) {
balance += v
func withdraw(v float64) (float64, bool) {
if v <= balance {
balance -= v
return v, true
return 0, false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.