Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprenda O Que São Métodos? | Métodos
Quizzes & Challenges
Quizzes
Challenges
/
Fundamentos de C#

bookO Que São Métodos?

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.

question mark

What is the closest definition of a method in C#?

Select the correct answer

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 6. Capítulo 1

Pergunte à IA

expand

Pergunte à IA

ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

bookO Que São Métodos?

Deslize para mostrar o 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.

question mark

What is the closest definition of a method in C#?

Select the correct answer

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 6. Capítulo 1
some-alt