How to swap two strings in Go

1 Answer

0 votes
package main

import "fmt"

func main() {
    s1 := "Go"
    s2 := "Java"
    
    s1, s2 = s2, s1
    
    fmt.Printf("s1 = %s s2 = %s\n", s1, s2)
}





/*
run:
   
s1 = Java s2 = Go
   
*/

 



answered Sep 24, 2021 by avibootz
...