I am new to Go. I have 2 questions:
Is there a way to get all the numbers between a range in Go? I can do range(1, 10)
in Python or 1 to 10
in Scala to get a range.
How to get all the alphabets in go? Like Python's string.letters
and string.ascii_lower
.
Go doesn't provide a lot of syntactic sugar. You just have to write what those Python and Scala functions do for you.
for i := 1; i <= 10; i++ {
fmt.Print(i)
}
for i := 'A'; i <= 'Z'; i++ {
fmt.Printf("%c", i)
}
for i := 'a'; i <= 'z'; i++ {
fmt.Printf("%c", i)
}
12345678910ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz