Instantly share code, notes, and snippets.

View Mars Lander 2
package main
import "fmt"
//import "os"
type XY struct {
X int
Y int
}
func main() {
var surfaceN int
fmt.Scan(&surfaceN)
View RELUE
//
package main
import "fmt"
func main() {
var total int
var n int = 1000/3
for i:=1; i<n+1 ; i++ {
total+=i*3
}
n=(1000-1)/5
View BATMAN
package main
import "fmt"
//import "math"
//import "os"
type AB struct {
A int
B int
}
View String
import "strings"
import "strconv"
Atoi (string=>int)
if s, err := strconv.Atoi(v); err == nil {}
Itoa (int=>string)
s := strconv.Itoa(i)
Contains ?
View Array_Slice
func whereismymin(Slice []float64) int {
var N int = len(Slice)
var min float64 = Slice[0]
var posmin int
for i:=1 ; i<N ; i++ {
if Slice[i]<min {
min = Slice[i]
View Go Basics
//Déclaration de valeur
var N int = 1
var i, j int = 1, 2
var Slice []int = [1]
//Conversion
var a float64 = float64(b)
a:= float64(b)
var a uint = uint(f)
View Fonction de base
//VALEUR ABSOLUE SUR ENTIER
func abs(n int) int {
if n < 0 {
return -n
}
return n
}