GOLANGPROFI Telegram 103
Ответ на «Как легче всего проверить срез на пустоту?»

Легче всего проверить срез на пустоту с помощью встроенной функции len(), которая возвращает длину среза. Если len(slice) == 0, значит срез пуст.

Например:

package main
import "fmt"
func main() {
r := [3]int{1, 2, 3}
if len(r) == 0 {
fmt.Println("Empty!")
} else {
fmt.Println("Not Empty!")
}
}

#задача
😁20👍3👎3🤔1🤯1



tgoop.com/golangprofi/103
Create:
Last Update:

Ответ на «Как легче всего проверить срез на пустоту?»

Легче всего проверить срез на пустоту с помощью встроенной функции len(), которая возвращает длину среза. Если len(slice) == 0, значит срез пуст.

Например:

package main
import "fmt"
func main() {
r := [3]int{1, 2, 3}
if len(r) == 0 {
fmt.Println("Empty!")
} else {
fmt.Println("Not Empty!")
}
}

#задача

BY Golang Юниор


Share with your friend now:
tgoop.com/golangprofi/103

View MORE
Open in Telegram


Telegram News

Date: |

The administrator of a telegram group, "Suck Channel," was sentenced to six years and six months in prison for seven counts of incitement yesterday. 2How to set up a Telegram channel? (A step-by-step tutorial) Telegram users themselves will be able to flag and report potentially false content. While some crypto traders move toward screaming as a coping mechanism, many mental health experts have argued that “scream therapy” is pseudoscience. Scientific research or no, it obviously feels good. Find your optimal posting schedule and stick to it. The peak posting times include 8 am, 6 pm, and 8 pm on social media. Try to publish serious stuff in the morning and leave less demanding content later in the day.
from us


Telegram Golang Юниор
FROM American