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 "log" | |
func main() { | |
//---ログパッケージの使い方--- | |
//基本となるログ出力 | |
//log.Print("hello") | |
//ファイル名を出力するように設定を変更する。 |
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() { | |
//一文字でサイズがたまたま1になっている文字 | |
//message1 := "AB" | |
//fmt.Println(len(message1)) | |
//一文字だけど、サイズは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() { | |
//Array | |
//格納できるstringの個数は2個である。 | |
//型推論で定義している。 | |
arr := [2]string{} | |
fmt.Println(arr) |
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() { | |
pointerUser := &User{ | |
name: "tio", | |
} | |
fmt.Println(pointerUser.name) | |
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() { | |
//構造体を値として宣言する | |
//ataiUser := User{ | |
// name: "tio", | |
//} | |
//fmt.Println(ataiUser.name) |
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() { | |
//今までのプログラミング(型推論を利用している) | |
//str := "tio" | |
//fmt.Println(str) | |
//型推論なしの変数宣言 |
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
class User { | |
//staticなプロパティ | |
//Userクラスによって生成されたオブジェクトから利用することはできない。 | |
static staticProperty = "this is staticProperty" | |
constructor(name) { | |
//通常のプロパティ | |
this.name = name | |
} |