Create a new file

Report a typo

Suppose you want to create a file named new_file.txt.

Write the additional required Go code to achieve this task, remember to close the file at the end of the program!

Write a program
package main

import (
"log"
"os"
)

func main() {
// Write the code to create a new file "new_file.txt" below:
file, err := ?
if err != nil {
log.Fatal(err)
}

? // Remember to close the file!
}
___

Create a free account to access the full topic