0
What is the meaning of each word in this code
Kotlin main function https://code.sololearn.com/c19rG2RrhA29/?ref=app
3 Respuestas
+ 5
Avinesh Nice explanation. However, I have a few corrections to clarify.
Array<String> isn't the function parameter. Rather, it's the type declaration of the function parameter, which happens to be named `args`.
The function parameter is the variable declared to hold the value of the argument passed to the function when called.
Example of calling a function and passing argument values as an array of strings:
main(["value 1", "value 2"])
The values passed into the function are known as arguments. Here, it's only one array argument containing multiple string values.
The variables declared as function inputs are known as parameters.
Although the differences may seem to be subtle, they are quite distinct and should not be referred to interchangeably, especially in statically typed languages.
I hope this helps.
+ 3
Here 'main' is the name of the method and in many languages this method is considered as the starting point of your code execution.
The keyword 'fun' is used to define a function. Also the 'Array<String>' are called function parameters. It simply means that your 'main' function can accept an array of strings as a parameter.
'args' is the name of the parameter and sometimes arguments and parameters are interchangeably used.
0
Thanks bro for that
That's really helpful