Questions tagged [arguments]

An argument is a value passed to a function, procedure, or command line program. This also refers to the Array-like `arguments` object in JavaScript.

An argument is a value passed to a function, procedure, or program. It is often used interchangeably with the word "parameter", which also has more specific definitions. Usually "argument", or "actual parameter" (as opposed to "formal parameter") is the value of the parameter used within the called routine.

In other words, parameters are used in procedure definitions, and arguments are used in procedure calls.

arguments can also refer to the Array-like object in JavaScript that is available inside functions, this object can be used to access all of the function's arguments regardless of the function's signature.

11091 questions
4
votes
2 answers

PHP Class arguments in functions

I'm having trouble using an argument from my class in one of that class's functions. I have a class called company: class company { var $name; function __construct($name) { echo $name; } function name() { echo $name; …
Giles Van Gruisen
  • 961
  • 3
  • 13
  • 27
4
votes
4 answers

Varargs in a group?

About Varargs, can i repeat the arguments in a group? For instance, i want to allow users pass in: myFunc(1, "one"); myFunc(1, "one", 2, "two"); myFunc(1, "one", 2, "two", 3, "three"); It seems impossible. But as mentioned in the docs, the varargs…
midnite
  • 5,157
  • 7
  • 38
  • 52
4
votes
5 answers

How to pass an argument to a thread

Assume I would like to pass the following variable String foo = "hello world"; as an argument to the following thread new Thread(new Runnable() { @Override public void run() { // SOME CODE HERE REQUIRES VARIABLE …
androideka
  • 71
  • 1
  • 11
4
votes
2 answers

C function argument char * vs char []

I think this question is an extension of this SO answer. Say I have the following code: #include #include void func(char *str) { strcpy(str, "Test"); } int main() { char testStr[20] = "Original"; func(testStr); …
Anish Ramaswamy
  • 2,326
  • 3
  • 32
  • 63
4
votes
4 answers

Confused about R terminology: Attributes, parameters, and arguments

Once and for all I want to get the R terminology right. However, none of the books I was reading was of big help, and it seems to me the authors choose the names sometimes arbitrarily. So, my question is when exactly are the names "attribute",…
user2015601
4
votes
3 answers

how do I make a generic method lock its type in java?

what I mean about that is that in C# for example I can write a generic method like this: public static void Concatenate (T arg1, T arg2) { Console.WriteLine(arg1.ToString() + arg2.ToString()); } and then if I call the method in these…
Electric Coffee
  • 11,733
  • 9
  • 70
  • 131
4
votes
2 answers

How to make a function that accepts multiple parameter types in ActionScript 3?

Can anyone tell me how to make a function that works like below in ActionScript3.0? function test(one:int){ trace(one);} function test(many:Vector){ for each(var one:int in many){ test(one); } }
Elonoa
  • 467
  • 7
  • 19
4
votes
1 answer

Undefined function 'log' for input arguments of type 'uint8'

i have been trying generate an image. C1 = imread(InputImage); NumberOfGrayLevels=32; I= 0.299*C1(:,:,1)+0.587*C1(:,:,2)+0.114*C1(:,:,3); C = 0; I=(C*log(I+1))'; new=uint8(mat2gray(I)*(NumberOfGrayLevels-1)); [m,n]= size(new); rgb =…
sat
  • 169
  • 1
  • 3
  • 7
4
votes
1 answer

Trying to undersand how I can pass arguments from gradle to my shell script?

I'm trying to pass command line arguments to my shell script through a gradle task myconfiguration is like this below. task dosomething(type:Exec) { workingDir 'dir' executable 'sh' args '-c','source dosomething.sh $arg' } And I'm trying to…
ZekeJackhammer
  • 137
  • 1
  • 7
4
votes
2 answers

Should a subroutine croak when called with more arguments than expected?

Should a subroutine croak when called with more arguments than expected or should the extra arguments simply be ignored? #!/usr/bin/env perl use warnings; use strict; sub routine { my ( $a, $b ) = @_; return $a * $b; } my $reslult =…
sid_com
  • 24,137
  • 26
  • 96
  • 187
4
votes
3 answers

How can I have my command-line arguments parsed automagically using annotations?

I'd like something like the following to work: public class A { @command_line_arg{"argname1"} static boolean x; @command_line_arg{"argname2"} static List y; void main(String[] args) { /* perhaps a call such as…
einpoklum
  • 118,144
  • 57
  • 340
  • 684
4
votes
3 answers

Can you pass keyword arguments instead of positional arguments to argparse?

Suppose you have a python function, as so: def foo(spam, eggs, ham): pass You could call it using the positional arguments only (foo(1, 2, 3)), but you could also be explicit and say foo(spam=1, eggs=2, ham=3), or mix the two (foo(1, 2,…
technillogue
  • 1,482
  • 3
  • 16
  • 27
4
votes
5 answers

How do I suppress the errors that occur when a user calls my powershell script without a parameter argument

For example, my script can be called like this: .\MyScript.ps1 -s If I call it without passing an argument with the -s parameter, I receive an error: .\MyScript.ps1 -s C:\MyScript.ps1 : Missing an argument for parameter 'sql'. Specify…
EGr
  • 2,072
  • 10
  • 41
  • 61
4
votes
2 answers

Pass function argument into getElementById "id"

It's a js function that shows various text input forms when you select an apropriate value from a select box. function arata_formular(formular) { document.getElementById("formular").style.visibility = "visible"; …
erasmus77
  • 327
  • 1
  • 5
  • 16
4
votes
1 answer

Python **kwargs and self as an argument

I don't have much experience in python but I am studying **kwargs. Afer reading a lot I understood somethings about **kwargs but I have a small problem or I am not understanding something correct. So this works: def test_var_kwargs(farg, **kwargs): …
Jimmy Kane
  • 16,223
  • 11
  • 86
  • 117