Callbacks https://play.golang.org/p/oPTSePAAHNj

https://play.golang.org/p/oPTSePAAHNj

When I run this program, I don’t know where 45 comes from. Because the sum of the numbers is 44

No: https://duckduckgo.com/?q=1%2B+2%2B+3%2B+4%2B+5%2B+6%2B+7%2B+8%2B+9&t=h_&ia=calculator

Oh gosh ! LOL You’re right! How did I screw that up??? I guess I better go back to 3rd grade!

When you encounter a problem like this, it often helps a lot to do the math on a calculator, and re-read your code to see exactly what is happening.

Computers are just calculators and tools, and they do not make math mistakes. If a result isn’t what you expect, you either have a code problem or a user problem :stuck_out_tongue:

3 Likes

Lol. Hey thanks. Good advice

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.