Menu
Coddy logo textTech

Recap - Repeating Actions

Part of the Fundamentals section of Coddy's GO journey — lesson 50 of 109.

challenge icon

Challenge

Easy

Complete the code to implement different types of loops and print the results.

Try it yourself

package main

import "fmt"

func main() {
  // TODO: Write a for loop that prints numbers from 1 to 5
  // Each number should be on its own line
  
  // TODO: Print a blank line for separation
  
  // TODO: Write a for loop that calculates the sum of numbers from 1 to 5
  // Store the result in a variable named 'sum'
  // After the loop, print "Sum: 15"
  
  // TODO: Print a blank line for separation
  
  // TODO: Write a for loop that starts at 10 and counts down to 1
  // Each number should be on its own line
}

All lessons in Fundamentals