This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main(){ | |
fmt.Println("Hello World") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main(){ | |
nilai := 3 | |
switch nilai { | |
case 1: | |
fmt.Println("nilai 1") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main(){ | |
for i := 1; i <= 10; i++ { | |
fmt.Println("sakura endo cantik", i) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main(){ | |
var nama_idol [4]string | |
nama_idol[0] = "sakura miyawaki" | |
nama_idol[1] = "aruno nakanishi" | |
nama_idol[2] = "sakura endo" | |
nama_idol[3] = "Itou Miku" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main(){ | |
var idol_grub = [4]string{"JKT48", "HKT48", "NOGIZAKA46", "AKB48"} | |
fmt.Println(idol_grub) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main() { | |
var vtuber = []string{"korone", "pekora", "moona"} | |
// tanpa memberikan berapa jumlah array | |
var newVtuber = vtuber[1:3] | |
fmt.Println(newVtuber) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main(){ | |
var idol map[string]string | |
idol = make(map[string]string) | |
idol["name"] = "sakura" | |
idol["age"] = "20" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main() { | |
// slice of map | |
students := []map[string]string{ | |
{"name": "sakura", "age": "20", "address": "jepang"}, | |
{"name": "aruno", "age": "20", "address": "jepang"}, | |
{"name": "sakura endo", "age": "20", "address": "jepang"}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main(){ | |
printMyResult("sakura") | |
} | |
func printMyResult(sentence string) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main(){ | |
JumlahLuas, jumlahKeliling := hitungReturnValue(30, 20) | |
fmt.Println("luas", JumlahLuas, "keliling", jumlahKeliling) | |
} | |
func hitungReturnValue(panjang, lebar int) (luas int, keliling int) { |
OlderNewer