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
1 answer

Ruby dot parenthesis call syntax

I was reading the jbuilder's README and saw these code: class Person # ... Class Definition ... # def to_builder Jbuilder.new do |person| person.(self, :name, :age) end end end I tried to replicate it myself, and it asks for a…
Dorian
  • 22,759
  • 8
  • 120
  • 116
6
votes
5 answers

C++ template nontype parameter arithmetic

I am trying to specialize template the following way: template // workaround: bool consecutive = (_1 == _2 - 1)> struct integral_index_ {}; ... template struct integral_index_<_1, _1 + 1> { // cannot do…
Anycorn
  • 50,217
  • 42
  • 167
  • 261
6
votes
2 answers

Swift assert with string parameters

Why in Swift is this legal... assert( false, "Unexpected diagnosis: \(diagnosis)" ); whereas this is not? let assertString = "Unexpected diagnosis: \(diagnosis)" assert( false, assertString ); In the second snippet, I get the error... Cannot…
Fittoburst
  • 2,215
  • 2
  • 21
  • 33
6
votes
2 answers

Autofill function parameters in Android Studio

I've been working in Android Studio recently, and was wondering if there is a hot key / setting / method for autofilling function parameters after a function call is autocompleted. For instance, if I type in db.query(), I would like the following to…
CodyF
  • 4,977
  • 3
  • 26
  • 38
6
votes
2 answers

Delphi How to retrieve all parameters as single string

application1 runs another application2 with 2 parameters eg: (NOTE: application1 is not my program) application2.exe -d:C:\Program Files\app folder -z:Folder menu\app icons Problem is... quotes somehow disappeared so instead of 2 parameters…
Nafalem
  • 261
  • 5
  • 16
6
votes
1 answer

Pass Variables to Project Parameters in SSIS

I am new to this network. Hoping I'll find an answer to this problem. I have a SSIS Project with multiple Packages which are using the Project Parameters. I am trying to update the Project Parameters e.g. @PeriodStart: 2014-05-31. I can't find a way…
Bal
  • 81
  • 1
  • 1
  • 6
6
votes
4 answers

How to pass specific variable in PHP function

I have a PHP function that requires can take 3 parameteres... I want to pass it a value for the 1st and 3rd parameters but I want the 2nd one to default... How can I specify which ones I am passing, otherwise its interpreted as me passing values…
Ian Storm Taylor
  • 8,520
  • 12
  • 55
  • 72
6
votes
3 answers

How to get command line parameters and put them into variables?

I am trying to make an application. Can someone help me how to get command line parameters and put them into variables/strings. I need to do this on C#, and it must be 5 parameters. The first parameter needs to be put into Title variable. The second…
Mihail Mojsoski
  • 79
  • 1
  • 1
  • 5
6
votes
4 answers

Writing C function parameter types after name list, and no type for some parameters

I've read some, to me, peculiar C-code while studying some examples in the book The Unix Programming Environment (1983). As a curiosity I wanted to find out more about the, let's call it "style". The point of interest here is the line just below…
user2590005
6
votes
1 answer

Why does my Perl program print the help message when an arguments has 0 as a value?

If i do this: GetOptions( 'u=s' => \$in_username, 'r=i' => \$in_readonly, 'b=i' => \$in_backup ); exit usage() unless $in_username && $in_readonly && $in_backup; and call the program like this: ./app.pl -u david -r 12 -b 0 it…
David
  • 63
  • 2
6
votes
2 answers

Passing template function pointer to template as template parameter is too verbose

template Uptr makeUniquePtr(/*...*/) { /*...*/ }; template Sptr makeSharedPtr(/*...*/) { /*...*/ }; template void func(/*...*/) { /*...*/ } template
Vittorio Romeo
  • 90,666
  • 33
  • 258
  • 416
6
votes
7 answers

Correct way to (re)launch a Java application with hardware-dependent VM parameters?

EDIT I don't want to use Java Web Start I've got a Java application that I'd like to run with different VM parameters depending on the amount of memory the system it is launched on has. For example if the machine has 1 GB of memory or less I'd like…
6
votes
1 answer

C# params on method signature doesn't break an override / implementation

I have the following abstract base class: public abstract class HashBase { public abstract byte[] Hash(byte[] value); } And then I go ahead and implement that class: public class CRC32Hash : HashBase { public override byte[] Hash(params…
Matthew Layton
  • 39,871
  • 52
  • 185
  • 313
6
votes
3 answers

Dropdown selected based on URL parameter - PHP or jQuery?

What's the best method to output "selected" for my form select based on the URL parameter? In my URL I might have this parameter &term=retail. How could I tell the below code to select the retail option?