

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 5
click for more info
Not enough gems
Cost: 6 gems
1: Loops in Go
incomplete
2: Omitting Conditions from a for Loop in Go
incomplete
3: There Is No While Loop in Go
incomplete
4: Fizzbuzz
incomplete
5: Continue & Break
incomplete
6: Connections
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
The basic loop in Go is written in standard C-like syntax:
for INITIAL; CONDITION; AFTER{
// do something
}
INITIAL is run once at the beginning of the loop and can create
variables within the scope of the loop.
CONDITION is checked before each iteration. If the condition doesn't pass
then the loop breaks.
AFTER is run after each iteration.
For example:
for i := 0; i < 10; i++ {
fmt.Println(i)
}
// Prints 0 through 9
At Textio we have a dynamic formula for determining how much a batch of bulk messages costs to send. Complete the bulkSend() function.
It should return the total cost (as a float64) to send a batch of numMessages messages. Each message costs 1.0, plus an additional fee. The fee structure is:
1.0 + 0.001.0 + 0.011.0 + 0.021.0 + 0.03Use a loop to calculate the total cost and return it.
You can use float64(x) to convert the value to float64.