jeudi 20 mai 2021

How can i call functions on Golang?

I started coding a few days ago and I don't know how to call functions for a small project that I create now. It's a simple question but I'm struggling a lot. I will leave my code below, thank you!

package main

import "fmt"

func law(grade int) (mathews, john int) {
    mathews = 65
    john = 69
    grade = 70
    return
}

func main() {
    law()
    if mathews < grade {
        fmt.Println("Mathews, you are not allow to join on Harvard.")

    } else {
        fmt.Println("Congratulations, Mathews. You passed!")
    }
    if john < grade {
        fmt.Println("John, you are not allow to join on Harvard.")
    } else {
        fmt.Println("Congratulations, John. You passed!")
    }
}

Aucun commentaire:

Enregistrer un commentaire