sudo dnf install golang
Using a loop, print every number between 1 and 100 !
Code a "simpleCalculator" function that adds two numbers together
This function takes 2 parameters:
- The number on the left of the '+' operator
- The number on the right of the '+' operator
simpleCalculator(2, 2) -> 4
You can add any other operation !
Write a "countLetter" function to count all letters from a file and print it.
This function take 1 parameter:
- The file path of your file.
countLetter("myFile")
Write a "countWord" function whose objective is to count the number of times a word appears in a sentence.
This function takes 2 parameters:
- The sentence you will search through.
- The word you look for in the sentence.
countWord("My cat is playing with my dog!", "my") -> 2
Make a simple "checkThat" function to check parameter integrity !
This function takes 1 parameter:
- A list of input parameters.
checkThat([1, 2, 3, 4, 5]) -> true
checkThat([1, 2, 3, a, 5]) -> false
Now, let's make an "appendTofile" function which appends a string to a file !
That function takes 2 parameters:
- The file you want to append to.
- The string you want to append to your file.
appendToFile("myFile", "append this") -> if file empty : "append this"
appendToFile("myFile", "append this") -> if file is not empty : "... append this"
Now to test all of your functions, make some unit tests !
If you reached this part, you learned a lot. But if you want to learn more, take a look at class and make Human class with age, name, ect.