// Homework 37, problem 1: Hand back a sum. // // sumUpTo is provided. Make a channel of int. Start a goroutine that // computes sumUpTo(100) and sends the answer on the channel. In main, // print "Working on it...", then receive the answer and print // "The sum of 1 to 100 is ". // // Run with: go run exercises/37/homework/01-hand-back-a-sum.go package main import ( "fmt" "time" ) // sumUpTo adds 1 + 2 + ... + n, slowly. func sumUpTo(n int) int { time.Sleep(300 * time.Millisecond) sum := 0 for i := 1; i <= n; i++ { sum += i } return sum } func main() { // TODO: write your code here, in place of this placeholder line: fmt.Println("TODO: replace this line") }