Browse Source

DEV-3206-new-go-exercice-string-to-bool (#1353)

* DEV-3206 add(docs):StringTobool readme

* DEV-3206 fix(docs):replace the example

* Update README.md

* docs(stringtobool): fix subject

- upgraded instructions
- fix 'expected function'
- add missing import 'piscine'
- fix white-spaces and indentation

* docs(stringtobool): fix typo

---------

Co-authored-by: Tiago Collot <collot.tiago1@gmail.com>
Co-authored-by: Michele Sessa <mikysett@gmail.com>
pull/1513/head
Hamza elkhatri 1 year ago committed by GitHub
parent
commit
8468df1f05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 46
      subjects/stringtobool/README.md

46
subjects/stringtobool/README.md

@ -0,0 +1,46 @@
## stringtobool
### Instructions
Write a function that takes a `string` as an argument and returns a `boolean`.
- If the `string` equals `True`, `T` or `t` return `true`, otherwise return `false`.
### Expected function
```go
func StringToBool(s string) bool {
}
```
### Usage
Here is a possible program to test your function:
```go
package main
import (
"fmt"
"piscine"
)
func main() {
fmt.Println(piscine.StringToBool("True"))
fmt.Println(piscine.StringToBool("T"))
fmt.Println(piscine.StringToBool("False"))
fmt.Println(piscine.StringToBool("TTFF"))
}
```
And its output:
```console
$ go run .
true
true
false
false
```
Loading…
Cancel
Save