Comment on Anon is a linguist
yetAnotherUser@discuss.tchncs.de 5 days agoIt’s calling a function without a parameter.
You know how in math you had something like:
f(x) = x²
Not all functions need parameters though. The function:
f(x) = 2
does not even use the provided x! So just leave it out:
f() = 2
Similarly, you could give a function two parameters:
f(x, y) = x + y
Programmers use functions to primarily organize their code. Otherwise it would get very unreadable very quickly. Those function are usually a bit more complicated than a single line, like.
Dog.walk() would call the walk() function of “Dog”. Some valid code could be:
Dog.walk() wait(10) Dog.stop()
This code would make the dog walk for 10 seconds assuming every function used is actually defined somewhere.
Camille_Jamal@sh.itjust.works 3 days ago
Okay, cool, thanks! :D