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.
 
 
 
 
 
 
lee 8ffc65ce3d chore(exam): remove all folders that contained "-exam" suffix & add the main.go to exercises that needed it 11 months ago
..
README.md chore(exam): remove all folders that contained "-exam" suffix & add the main.go to exercises that needed it 11 months ago
main.go chore(exam): remove all folders that contained "-exam" suffix & add the main.go to exercises that needed it 11 months ago

README.md

fishandchips

Instructions

Write a function called FishAndChips() that takes an int and returns a string.

  • If the number is divisible by 2, print fish.
  • If the number is divisible by 3, print chips.
  • If the number is divisible by 2 and 3, print fish and chips.
  • If the number is negative return error: number is negative.
  • If the number is non divisible by 2 or 3 return error: non divisible.

Expected function

func FishAndChips(n int) string {

}

Usage

Here is a possible program to test your function:

package main

import (
	"fmt"
	"piscine"
)

func main() {
	fmt.Println(piscine.FishAndChips(4))
	fmt.Println(piscine.FishAndChips(9))
	fmt.Println(piscine.FishAndChips(6))
}

And its output:

$ go run . | cat -e
fish$
chips$
fish and chips$