Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "fmt"
- "log"
- "reflect"
- )
- func main() {
- langs := [4]string{"Go", "Python", "Ruby", "PHP"}
- slice := langs[0:4] // Upper bound excluded.
- // Print out the types of these variables
- fmt.Println(reflect.TypeOf(langs))
- fmt.Println(reflect.TypeOf(slice))
- if !(langs[3] == "PHP") {
- log.Fatal("Wrong value")
- }
- slice[3] = "Perl"
- if !(langs[3] == "Perl") {
- log.Fatal("Wrong value")
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement