Hi there! Here I am coding again. For those of you readers who may not know what recursion is, I have a brief explanation: a function is called a recursive function when it calls itself. A very nice example is the factorial, which is also what I am going to code today. For the factorial of $N$, $f(N)$, we can state that $f(N) = N\times f(N-1)$. What we see is that the function is represented by itself, but with other argument and it can keep this going up to a certain point for which we know the answer like $f(1)=f(0)=1$. Given this introduction, I will code.

package main

import "fmt"

// N > 0 always!
func factorial(N uint) uint {
if N > 1 {
return N * factorial(N-1)
}
return 1
}

func main() {

var N uint
fmt.Scanln(&N)
fmt.Printf("%d\n", factorial(N))

}



Usually I say what point I had difficulties, but I confess I had no problems with this one today. Thanks for reading! If you have any doubts, critics or suggestions, let me know!
{"ft_lang_label":"__label__en","ft_lang_prob":0.9409697,"math_prob":0.95916605,"size":942,"snap":"2021-21-2021-25","text_gpt3_token_len":246,"char_repetition_ratio":0.10127932,"word_repetition_ratio":0.0,"special_character_ratio":0.27707008,"punctuation_ratio":0.11594203,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9894046,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-05-14T01:13:27Z\",\"WARC-Record-ID\":\"<urn:uuid:28603ae9-c74e-4def-8d80-92273beb7802>\",\"Content-Length\":\"20006\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:fa258332-cd6b-4267-9504-0e6731261423>\",\"WARC-Concurrent-To\":\"<urn:uuid:a577f18f-962d-47c4-ac8a-7b1265923bcd>\",\"WARC-IP-Address\":\"13.249.42.46\",\"WARC-Target-URI\":\"https://ataias.com.br/2016/09/15/30-days-of-code-in-go-day-9-recursion/\",\"WARC-Payload-Digest\":\"sha1:VUJN5BTPECD7MTMUFTG4RCOSYGIFIIRZ\",\"WARC-Block-Digest\":\"sha1:OOZRWLEQ374RMIP7EEUFBBPGRY7WDGR2\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-21/CC-MAIN-2021-21_segments_1620243989616.38_warc_CC-MAIN-20210513234920-20210514024920-00303.warc.gz\"}"}