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

Why is SSMS altering my stored procedures (re-formatting, changing exec to EXECUTE, etc.)

SSMS is suddenly re-formatting my stored procedure - it has never done this before. Here's an example of what I'm talking about. Here's the start of the stored procedure I created last week: CREATE PROCEDURE [dbo].[usp_LoanDataNames] ( @LoanID…
6
votes
2 answers

Call stored procedure specifying only parameters with a value

In an instance of SQL Server 2016 I have a stored procedure with dozens of parameters. For example: CREATE PROCEDURE spName ( @par1 INT = NULL, @par2 VARCHAR(10) = NULL, .... .... @par98 INT = NULL, @par99 INT =…
6
votes
2 answers

Passing Parameters back and forth between forms in C#

I am creating an application where a user will click a button on form1, which will cause form2 to display. The user will then fill out a chat on form2 and then click a button that will close form2 and send back parameters to form1 for processing.…
Franz Payer
  • 4,069
  • 15
  • 53
  • 77
6
votes
2 answers

argument of type 'number' is not assignable to a parameter of type 'string'

I'm quite new to typescript so forgive me if this is a noob question. I'm making a simple master detail application using angular cli. However i'm getting this error argument of type 'number' is not assignable to a parameter of type 'string' For as…
Gurbii
  • 245
  • 2
  • 5
  • 15
6
votes
1 answer

How to combine getopts and positional parameters in bash?

I want to use both getopts and positional parameters, but if I pass in a positional parameter to the program the getopts get lost. directory=$1 while getopts l: flag; do case "$flag" in l) level=$OPTARG;; esac done if [ -n "$level" ];…
bntzio
  • 1,274
  • 14
  • 27
6
votes
4 answers

Passing a PowerShell variable as a cmdlet parameter

I am learning PowerShell to write tools for my team. I was in a pinch today and got this working, but I want to streamline it by removing the IF statements in the ForEach loop, since the only difference between the commands is the parameter -replace…
6
votes
2 answers

Why can't I pass template parameters on to another template?

Okay I'm going to give a simple example of my problem: void Increment(Tuple& tuple) { ++tuple.Get<0>(); } int main() { Tuple tuple; tuple.Get<0>() = 8; Increment(tuple); printf("%i\n", tuple.Get<0>()); //…
nonoitall
  • 1,232
  • 1
  • 15
  • 25
6
votes
2 answers

Avoid passing undefined for optional parameters

If I have a constructor that has n optional parameters and I want to pass a value for only the last optional parameter, I have to pass undefined n-1 times. For example: class House() { constructor(door?, roof?, windows?) { } } If I want to…
Dave Clark
  • 2,243
  • 15
  • 32
6
votes
1 answer

Why can PHP Functions accept boolean arguments when it asks for integers?

I was reading in a WordPress textbook where I found a quick description for the following function: function is_super_admin( $user_id = false ) {... This function determines if the user is a site admin. However, my question is about the how PHP…
WPStudent
  • 81
  • 1
  • 4
6
votes
1 answer

Creating an integer to use with param type integer in ColdFusion

I'm a fan of using required arguments with types where appropriate. I want to write a function which requires an integer as an argument and errors if it is passed anything else. Generally I have been using required numeric num however numeric will…
sauntimo
  • 1,531
  • 1
  • 17
  • 28
6
votes
1 answer

Use of C's '...' parameter pack as C++ template value?

I have spent the last few days trying to create a generalised wrapper of sorts for function pointers in C++ and I've managed to solve nearly every single issue bar one. My main goal with this was to be able to simply call an object as a function…
6
votes
2 answers

Powershell: passing parameters to a job

I have a script that requires a number of parameters: param ([string]$FOO="foo",[string]$CFG='\ps\bcpCopyCfg.ps1', [string]$CFROM="none", ` [string]$CTO="none", [switch]$HELP=$FALSE, [switch]$FULL=$FALSE, [string]$CCOL="none"…
Lubo
  • 61
  • 1
  • 1
  • 2
6
votes
3 answers

Jmeter JDBC Connection Configuration Parametrization of Database URL for accessing MySQL Database

How to parametrize Database URL under JDBC Connection Configuration? Normal parametrization is not working here. This doesn't work: Database URL: jdbc:mysql://${mysql_hostname}:${mysql_port}/${mysql_database} JDBC Driver Class:…
Nelly
  • 137
  • 2
  • 10
6
votes
4 answers

Best practice for using date parameters in Spring controllers?

After written several backend APIs, I found that the following code duplicates in almost every method which needs to filter data by dates: @GetMapping(value="/api/test") @ResponseBody public Result test(@RequestParam(value = "since", required =…
Fred Pym
  • 2,149
  • 1
  • 20
  • 29
6
votes
3 answers

Typescript type assertions in parameters

I'm liking typescript so far, but find that i need to do type assertion a lot. For example casting an EventTarget to an HTMLAnchorElement is a common use case for me. However to get that, i need to use something like the…
C02Equinox
  • 61
  • 1
  • 6