Skip to content

Instantly share code, notes, and snippets.

@Cibernomadas Cibernomadas/main.go
Created May 20, 2018

Embed
What would you like to do?
if decimal {
switch cmd {
case "suma":
txt = fmt.Sprintf("%f", af+bf)
case "resta":
txt = fmt.Sprintf("%f", af-bf)
case "multi":
txt = fmt.Sprintf("%f", af*bf)
case "div":
if bf == 0 {
txt = "No es posible dividir un número por cero"
} else {
txt = fmt.Sprintf("%f", af/bf)
}
}
} else {
switch cmd {
case "suma":
txt = fmt.Sprintf("%d", a+b)
case "resta":
txt = fmt.Sprintf("%d", a-b)
case "multi":
txt = fmt.Sprintf("%d", a*b)
case "div":
if b == 0 {
txt = "No es posible dividir un número por cero"
} else {
txt = fmt.Sprintf("%d", a/b)
}
}
}
enviarMensaje(bot, update.Message.Chat.ID, update.Message.MessageID, txt)
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.