Most voted "parameters" questions
Parameters are a type of variable used in the subroutine to refer to the data provided as input to the subroutine.
Learn more…208 questions
Sort by count of
-
151
votes7
answers26094
viewsWhat is the difference between parameter and argument?
I have always used the terms "parameter" and "argument" as if they were synonyms: what is passed to a function and/or what the function receives as input. In the same way, I have read one and…
-
29
votes3
answers660
viewsShould we validate function parameters?
In languages like Java, method parameters are "validated" in the build (at least the type): public void facaAlgo(String str) { // ... } // em algum outro lugar: int i = 2; this.facaAlgo(i); // erro…
-
28
votes2
answers16435
viewsWhat are the out and ref parameters
What is the use of parameter types ref and out of a method in C#? What is the difference between the two? Some example of each one’s use.
-
28
votes6
answers1694
viewsWhy not use a Boolean parameter?
I’ve seen in some places you shouldn’t wear something like this: int teste(object obj, bool especial) { ... } There within the function some operation will be done or not, depending on what you…
function encoding-style software-engineering parameters booleanasked 7 years, 8 months ago Maniero 444,682 -
25
votes4
answers4174
viewsWhat is the meaning of the operator ( * ) asterisk?
In C this operator is used in pointer type variables. However, in Python I don’t know which way, and why to use it. Therefore, what is the meaning of the operator (*) in the Python language?
-
17
votes4
answers1286
viewsHow many parameters should a method have?
What is the maximum number of parameters a method should have? When one must consider that there are too many parameters? And what to do in that case? Tupiniquim and object-oriented version of the…
oop software-engineering method parameters software-projectasked 7 years, 8 months ago Piovezan 15,850 -
14
votes2
answers2762
viewsWhat is the purpose of the void parameter in functions in the C language?
The parameter void it’s just semantic or he does something I don’t know? int main() { return 0; } int main(void) { return 0; }
-
14
votes2
answers1007
viewsHow does a method that can receive multiple parameters work?
According to the C documentation#: The method String.Format is responsible for converting the value of objects in strings based on the specified formats and inserts them in another character string.…
-
13
votes4
answers542
viewsIs there a design standard or recommendation that defines the optimal amount of parameters a function should have?
I always value writing my codes in a short and readable way. My motto is always to think that "someday someone will mess with my code and I want the person who does it to understand it easily".…
function encoding-style parameters language-independent argumentasked 6 years, 5 months ago Wallace Maxters 102,340 -
12
votes7
answers552
viewsWhat is the difference between these parameters (array) in these methods?
I see it a lot in methods class Exemplo { public function exemplo1(array $parameters = array()) { } public function exemplo2(array $parameters) { } public function exemplo3($parameters = array()) {…
-
12
votes3
answers419
viewsAssign type to parameters
It is possible to assign types for the parameters in functions in PHP? Example: public function random(int $length) { // ... }
-
12
votes4
answers1580
viewsIs this a common practice in object orientation?
In object orientation, one way to ensure encapsulation is to maintain the attributes of the private classes and modify their state via methods. In addition, to ensure the integrity of objects, it is…
-
11
votes3
answers1593
viewsFunction as parameter in jQuery functions
I always used some functions without really understanding what was happening and where such parameters came from. I speak of the following: Example 1: $("#link").on("click", function(event){…
-
9
votes3
answers197
viewsWhat is the function of this 'and' that is passed as a parameter?
The example I’m going to show you here is just to illustrate. I’d like to really understand how this one works e which is usually passed as a parameter in various functions that matches in codes…
-
8
votes1
answer410
viewsMatrix parameter passing error
I am trying to understand the function of pointers for an array. For this, I have elaborated the small program below. I made some mistake, because, in the indicated line, error is occurring…
-
8
votes1
answer173
viewsAddorupdate - use array as parameter
I’m doing tests with Entity Framework and I had a problem when placing a array as a parameter. Why when I assign the conversion of array in a function variable and directly in the method parameter…
-
8
votes3
answers8112
viewsIs there any way to pass methods as a parameter?
In Java, I can pass methods as parameters? Example: public class Teste { public String metodoA(){ //faz alguma coisa } public void metodoB(double numero){ //faz alguma coisa } public void…
-
8
votes3
answers5416
viewsPhpdoc - What is, what is its utility and how to use it?
These days I’ve been doing a lot of work on frameworks files, projects, etc...and I’m seeing a lot of things I’ve never seen, one of them is the one with Phpdoc (I got the name thanks to my IDE),…
-
7
votes1
answer360
viewsProblem with types in function parameter
When executing the following code: function foo(string $text) { echo $text; } foo('bar'); I get the following error: PHP Catchable fatal error: Argument 1 passed to foo() must be an instance of…
-
7
votes2
answers2674
viewsReceive indefinite amount of parameters in C#
The method Main(string[] args) receives an array of indefinite amount parameters. But I know this doesn’t work in a common method. How to create a method that takes as many parameters as needed?…
-
7
votes2
answers350
viewsHow to get the set of all Python arguments?
Python has both positional and named parameters and operators * and ** which allow receiving an arbitrary number of additional arguments: def foo(a, b, c=1, *args, **kwargs): print(a, b, c, args,…
-
7
votes2
answers1189
viewsWhat is an output parameter?
Consider the following example: appendFooter(s); Analyzing the function signature, we have the following: public void appendFooter(StringBuffer report) The parameter s is considered in the above…
function parameters language-independent computer-scienceasked 8 years, 2 months ago Filipe Moraes 8,737 -
7
votes1
answer153
viewsWhat is an equal input parameter (allocation operator)?
I have a function defined as follows: public classeDeRetorno nomeDaFunção(string param1, string param2, string param3 = "") What does the param3 = ""? It equals the parameter to ""?…
-
7
votes2
answers362
viewsHow to pass an array as argument of a function per copy?
Like we know a array is used as a pointer in various situations. A parameter that waits for a array is actually a pointer, so what you copy is the memory address and not the data from array, is a…
-
7
votes1
answer172
viewsWhat is the role of parameters?
I know the concept of função and procedimentos, but I’m having a little trouble understanding the role of parameters.
-
6
votes2
answers280
viewsPass two parameters to a function that accepts only one parameter
I’ve been making a code to generate a pdf from the framework Itext in Java. I came across the following situation, I needed to define a phrase as negrito and sublinhado. After searching Google, I…
-
6
votes2
answers8444
viewsPass generic list as parameter
You can pass a generic list by parameter? Ex: I have one List<Pessoa> and a List<object>. and I have my method: public void FaçaAlgo(List<T> lista) { } How can I make my method…
-
6
votes2
answers1558
viewsCheck if a parameter has been provided for the function
Assuming a Javascript function with parameters: function minhaFuncao (param1, param2, param3) { // fazer algo ... } And then using it as follows: var param1 = "bubu"; minhaVariavel = minhaFuncao…
-
6
votes1
answer111
viewsIs it incorrect to change the arguments in an extended class in PHP?
It is incorrect (or "semantically incorrect") to change the arguments in an extended class in PHP? For example I created this class: class Bar { public function __construct($message, $code, $timer)…
-
6
votes2
answers335
viewsHow do the parameters that LINQ methods receive work?
How the parameters within these methods that receive these parameters work: <TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate) An example is the method…
-
6
votes2
answers929
viewsWhat is the difference between expressions : "int a" and "const int& a" as C++ function arguments?
Let’s assume I have two functions: int soma_a(int a, int b){ return a + b; } and int soma_b(const int& a, const int& b){ return a + b; } What would be the difference between soma_a and…
-
6
votes3
answers425
viewsIs it mandatory to put the same attributes on different constructors?
I have these builders: //1st Constructor - Create bike with a new frame public Motociclo (String marca, String modelo, float peso, int robustez) { //Nivel 2 this.marca = validarMarca(marca);…
-
5
votes1
answer190
viewsParameter for Stored Procedure not identified
I’m having a problem, which would be a mistake saying that there is no parameter being passed to the Procedure. It is running the following code: cmdProcedure.Parameters.AddWithValue("@id", 0);…
c# asp.net-mvc parameters ado.net stored-proceduresasked 10 years, 10 months ago Luiz Negrini 1,424 -
5
votes1
answer2491
viewsDifferences in the dynamic creation of an object
When I create an object dynamically, for example a form, I do so: Formulario := TFormulario.Create(nil); try Formulario.ShowModal; finally Formulario.Free; end; What’s the difference in creating an…
-
5
votes2
answers2276
viewsMethods without parameters and with parameters
Declaration methods without parameters: void exemploDeMetodo(){ int i; } Calling methods without parameters: exemploDeMetodo(); If I want to make a method with parameters it’s like? That’s the way…
-
5
votes3
answers9803
viewsPassing array as a function parameter
I want to receive the array containing numbers 3, 15 and 23 and array output display double. Only it is giving the following error: Warning: Missing argument 1 for criando_array(), called in…
-
5
votes5
answers25936
viewsHow to pass a list of values to a Stored Procedure?
I’m creating a stored Procedure in SQL Server 2008 R2 and would like to pass a list of values per parameter, for example: Table produto ---------------- | id | nome | | 1 | maçã | | 2 | pera | | 3 |…
-
5
votes1
answer557
viewsHow to get command line parameters / file path
I am developing an application, and accurate by parameters/commands next to the file path. For example, these flags: C:/caminho_do_arquivo -r C:/caminho_do_arquivo -v And in the code there would be…
-
5
votes1
answer543
viewsParameter of any type in method
I am building a method and would like it to extend into any type. For now I am using string but I would like the same to work for int, float, double and datetime. public static bool isNotNull(string…
-
5
votes5
answers1659
viewsDefault parameters
I’m having a problem with the parameters in a PHP function. For example: function exemplo($par1 = 1, $par2 = 2) { return $par1 . " - " . $par2; } exemplo(); // 1 - 2 exemplo(3); // 3 - 2 exemplo(3,…
-
5
votes2
answers395
viewsBehavior of parameters in the class constructor in C#
I have a question regarding the behavior of the parameters passed to the constructor of a class, they are by default ref/out or value? Searching on the behavior of parameters in common methods they…
-
5
votes5
answers156
viewsType induction for any type of object
I am wanting to make a method of a certain class accept an object as a parameter. However, this object could be of any type. Example: class classeExemplo { public function meuMetodo(Object $objeto)…
-
5
votes1
answer615
viewsWhat does the term "String... string" mean in java?
What the term means String... string in Java? And how to elaborate a method that returns a String... as an example: public String... getStrings(){ return String... s;) } I know it’s not like that,…
-
5
votes1
answer476
viewsWhy use pointers as function parameters?
I already have a certain knowledge about pointer, but I wanted to understand why in most cases people use pointers as parameters in functions. Currently I have been studying algorithms through the…
-
5
votes3
answers9397
viewsHow to pass arguments by reference in Python?
When I studied Pascal remember that my teacher explained that to pass an argument by reference it was necessary to put var in front of the variable, in the function/procedure parameters. Example:…
-
5
votes1
answer67
viewsWhat is the syntax that comes before the variable name in function parameters?
Reading the PHP documentation I came across the following example: function bar(A $a = null, $b) {} // Ainda permitido function bar(?A $a, $b) {} // Recomendado I did a little digging and figured…
-
5
votes3
answers144
viewsIs there any way to pass the parameters to a constant function?
I’m trying to do the following, I have this connection to Influxdb: InfluxDBClient('localhost', 8086, 'root', 'root', 'example') But I want to turn these parameters into a constant, so I don’t have…
-
4
votes2
answers99
viewsPreset in Javascript function parameters
Is it possible to make parameter presets in Javascript functions? Something like: function teste(oi = "ola", type = 1) { To predefine variables if they are not defined?…
-
4
votes2
answers8619
viewsPass parameter in View
How do I pass a parameter to a view in Mysql? Using SQL Server simply put WHERE u.nome = @nome that would solve the problem. Below is the view of the problem in SQL: CREATE VIEW `view_conta_pessoa`…
-
4
votes1
answer282
viewsIs sending parameters to another function using object or hash a good practice?
Exemplo: function atualizar(dados, events) { //faz qualquer tratamento dos valores var hash = { novoValor: dados, outroValor: event }; // primeira opção return customize(dados, event); // segunda…