You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Hamza elkhatri 8468df1f05
DEV-3206-new-go-exercice-string-to-bool (#1353)
1 year ago
..
README.md DEV-3206-new-go-exercice-string-to-bool (#1353) 1 year ago

README.md

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

func StringToBool(s string) bool {

}

Usage

Here is a possible program to test your function:

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:

$ go run .
true
true
false
false