How to stop a program in Go

1 Answer

0 votes
package main

import (
    "fmt"
    "os"
)

func main() {
    fmt.Println("abc")
    
    os.Exit(0)  
    
    fmt.Println("xyz")
}



/*
run:

abc

*/

 



answered May 19, 2025 by avibootz

Related questions

2 answers 115 views
2 answers 252 views
1 answer 214 views
1 answer 231 views
1 answer 175 views
175 views asked May 19, 2025 by avibootz
...