Qu'est-ce que les Méthodes ?
In C#, when we want to reuse a piece of code many times at relevant places then we use something called a method.
Consider a method like a labeled block of code which we can execute on demand whenever we want:
In the image above, we use countToTen as a reference for the boxed code on the right. Every method has a name, and you can execute the code in that method using the syntax methodName();. While there are cases where the syntax might differ, we'll explore those in later chapters. The key takeaway here is that a piece of code is labeled as countToTen, allowing us to execute it multiple times simply by writing countToTen() instead of rewriting the entire code.
Merci pour vos commentaires !
Demandez à l'IA
Demandez à l'IA
Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion
Awesome!
Completion rate improved to 1.59
Qu'est-ce que les Méthodes ?
Glissez pour afficher le menu
In C#, when we want to reuse a piece of code many times at relevant places then we use something called a method.
Consider a method like a labeled block of code which we can execute on demand whenever we want:
In the image above, we use countToTen as a reference for the boxed code on the right. Every method has a name, and you can execute the code in that method using the syntax methodName();. While there are cases where the syntax might differ, we'll explore those in later chapters. The key takeaway here is that a piece of code is labeled as countToTen, allowing us to execute it multiple times simply by writing countToTen() instead of rewriting the entire code.
Merci pour vos commentaires !