Created
May 20, 2018 21:28
-
-
Save Cibernomadas/c4448b12d365315068daf941741d8222 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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