This commit is contained in:
a.pivkin
2025-07-16 08:15:26 +03:00
parent cebbf27b3a
commit 0635aaa5ae
53 changed files with 76 additions and 4 deletions
+17
View File
@@ -0,0 +1,17 @@
package main
import (
"bufio"
"fmt"
"os"
)
func main() {
var name string
input := bufio.NewScanner(os.Stdin)
if input.Scan() { //Capture input and save into buffer. Captures until \n
name = input.Text()
}
fmt.Println(name)
}
+3
View File
@@ -0,0 +1,3 @@
module main.go
go 1.24.4
+37
View File
@@ -0,0 +1,37 @@
package main
import "fmt"
func main() {
name := "Привет"
fmt.Printf("String is %s\n",name)
fmt.Printf("Runes: ")
for i:=0; i < len(name); i++ {
fmt.Printf("%x ", name[i])
}
fmt.Println()
fmt.Printf("Bytes: ")
for i:=0; i < len(name); i++ {
fmt.Printf("%c ", name[i])
}
fmt.Println("RUnes")
runeSlice := []rune(name)
fmt.Printf("Runes: ")
for i:=0; i < len(runeSlice); i++ {
fmt.Printf("%c ", runeSlice[i])
}
fmt.Println("Bytes to runes")
for id,runeVal := range name {
fmt.Printf("%c start at position %d\n", runeVal, id)
}
word1 := "Vasya"
word2 := "Petya"
if word1 != word2 {
fmt.Println("Not equal")
}
}