Skip to content

Commit c6b53ce

Browse files
committed
Doc updated
1 parent 2bc1afd commit c6b53ce

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,4 +112,22 @@ Includes(languages, "TypeScript").
112112
users := []User{{Id: 10, Name: "John"}, {Id: 11, Name: "Doe"}, {Id: 12, Name: "Sabrina"}}
113113
Reverse(users)
114114
// {{Id: 12, Name: "Sabrina"}, {Id: 11, Name: "Doe"}, {Id: 10, Name: "John"}}
115+
```
116+
117+
### FindIndex
118+
119+
```
120+
users := []User{{Id: 10, Name: "John"}, {Id: 11, Name: "Doe"}, {Id: 12, Name: "Sabrina"}}
121+
FindIndex(users, func(user User, _ int) bool {
122+
return user.Name == "Doe"
123+
})
124+
// 2
125+
126+
users := []string{"User1", "User2", "User3", "User4"}
127+
128+
FindIndex(users, "User1")
129+
//0
130+
FindIndex(users, "User5")
131+
//-1
132+
115133
```

0 commit comments

Comments
 (0)