Golang Time Elapsed

[Solved] Golang Time Elapsed | Go - Code Explorer | yomemimo.com
Question : goland print the time it took for code to run

Answered by : byzef

package main
import (	"time" // Import this to be able to track time	"fmt" // Import this to print in console
)
//This app will check how long it takes for the computer to print 2000 numbers
func main () {	start := time.Now()	for i := 0; i < 2000; i++{	fmt.Println(i)	}	elapsed := time.Since(start) // This will check how long has passed since time.Now() was executed	fmt.Println(elapsed)
}

Source : https://coderwall.com/p/cp5fya/measuring-execution-time-in-go | Last Update : Sat, 05 Sep 20

Answers related to golang time elapsed

Code Explorer Popular Question For Go