Questions tagged [parameters]

Parameters are a type of variable used in a subroutine to refer to the data provided as input to the subroutine.

A parameter is an intrinsic property of a procedure, included in its definition. For example, in many languages, a minimal procedure to add two supplied integers together and calculate the sum total would need two parameters, one for each integer. In general, a procedure may be defined with any number of parameters, or no parameters at all. If a procedure has parameters, the part of its definition that specifies the parameters is called its parameter list.

There are two ways of passing parameters to a procedure (both of them may not be available in every programming language):

  • by value: the value of a variable (or constant, etc.) is passed to the procedure and the original variable cannot be affected by the code in the procedure.
  • by reference: the reference to a variable is passed to a procedure and the variable's value can be changed in the procedure.
22681 questions
6
votes
4 answers

Constructor chaining or use named/optional parameters

I'm a very new programmer and understand we want to minimize code redundancy so when we update we can make as few changes as possible and also minimize errors. So I have a Student class that I want overloaded constructor so If I do back chaining…
6
votes
2 answers

javascript function parameter with object notation

What is the differences between function updateSomething(item) {} and function updateSomething({items}) {} ? item variable in the first one can be an object too, why does the second one use an object notation? When should I use the first one and…
Sean
  • 981
  • 1
  • 9
  • 19
6
votes
2 answers

How to parametrize a test, taking the parameters from a parametrized fixture?

I apologize in advance for repeating the word parameter 1000 times. My use case is as follows. I'm using pytest to test a parser that parses fields out of product pages from an online shop. I have parametrized a fixture, so that each fixture…
cyberbikepunk
  • 1,302
  • 11
  • 14
6
votes
4 answers

Creating a new object and passing in method parameter

In Java we can create and pass a new object to a method within its parameters like so: wrapper.set_state( new Medium() ); What is the equivalent to this in C++? I suppose I could create the object before and then pass it, but being able to create…
M-R
  • 411
  • 2
  • 6
  • 15
6
votes
2 answers

D3 - Unable to get data parameter on click event

I'm trying to add an onClick event to my D3 barChart and perform some actions depending on the clicked bar, but I'm unable to get the event's 'data' parameter (undefined). Am I missing something? Thanks in advance! var data = [{ letter:…
sr.u
  • 155
  • 1
  • 8
6
votes
1 answer

How many parameters are too many in JavaScript?

I came across the following question on StackOverflow: How many parameters are too many? This got me thinking, is there a practical limit imposed on the number of parameters of a JS function? test(65536); // okay test(65537); // too…
Aadit M Shah
  • 72,912
  • 30
  • 168
  • 299
6
votes
2 answers

F# pipe first parameter

is that possible to pipe the first parameter into a multiple parameter function? for example date = "20160301" Is that possible to pipe date into DateTime.ParseExact( , "yyyyMMDD", CultureInfo.InvariantCulture)
tesla1060
  • 2,621
  • 6
  • 31
  • 43
6
votes
2 answers

YouTube parameter to call split view for 360 degree video

I'm trying to find out if the "VR mode" with two eye splitview of some YouTube 360 videos can also be called via a parameter or via the API? Right now when playing back a #360 video on my iPhone I'm able to move around in 360 degrees but the…
matt
  • 42,713
  • 103
  • 264
  • 397
6
votes
5 answers

Web Service: Single String Parameter Or Complex Type Parameters

Is it more or less acceptable (i.e. standard) to create a publicly-exposed web service with these method signatures: ThisMethodDoesSomething(ComplexType param) ThisMethodDoesSomethingElse(AnotherComplexType param) Or…
6
votes
3 answers

Parameters passing style in Perl

I see people using two styles for passing named parameters in Perl: use strict; use warnings; use Data::Dumper; sub foo { print Dumper @_; } sub bar { print Dumper @_; } foo( A => 'a', B => 'b' ); bar( { A => 'a', B => 'b' } ); What are…
Howard
  • 19,215
  • 35
  • 112
  • 184
6
votes
1 answer

How can you edit Build Parameters in Jenkins Workflow?

I know that you can access build parameters directly in the Jenkins Workflow. I have a parameter called BRANCH_REVISION which I need to update so that a call to the xml api will show the new value instead of the original value. This is something I…
Josh
  • 137
  • 1
  • 9
6
votes
4 answers

Javascript: undefined as a function parameter

On this page, it shows some example code, containing the following line: var Subject = ( function( window, undefined ) { What is the undefined as a function parameter?
Mr Mikkél
  • 2,577
  • 4
  • 34
  • 52
6
votes
5 answers

Restrict value of a parameter in a constructor AT DESIGN TIME

I'd like to restrict the value of a number parameter in a constructor to within a certain range. I know the conventional way is to do something like the following: public class Foo { public int MaxAmount { get; } public int Amount { get;…
user164226
6
votes
0 answers

Jenkins parametrized build, adding new form inputs dynamically

I have a Jenkins job with parametrized build. I was wondering if there is any way to make those parameters dynamic in a way that user can add/delete parameters when she hits "Build with parameters"? Something like jQuery dynamic input (I found an…
Odil
  • 81
  • 5
6
votes
2 answers

Dependency Injection - passing parameters to constructed types

I'm introducing Dependency Injection to my project. I've got a dialog window, which serves as an editor to either new or existing entity. Its ViewModel looks like the following: public class ContractWindowViewModel { private…
Spook
  • 25,318
  • 18
  • 90
  • 167