Quick actions

cmd+k|ctrl+k

Navigation

Languages

swap without temp variable

Snippet info

Language

Go

Visibility

public

Author

nico-latena

Created

2021-09-13T05:46:31.951487Z

Updated

2021-09-13T05:51:39.576329Z

package main

import (
    "fmt"
)

func main() {
    
    first := 1
    second := 2
    
    first = first-second // -1
    second = first+second // 1
    first = second-first // 2
    fmt.Println("First number :",first)
    fmt.Println("Second number :",second)
    
}
INFO