Questions tagged [parameter-passing]

parameter-passing is the process of assigning values to the parameters of a function

Association of actual and formal parameters upon function call. See Parameter Passing and its methods. The most widely used parameter passing methods are:

  • call-by-value
  • call-by-reference
  • call-by-value-result
  • call-by-name
  • call-by-need
  • macro expansion.
8028 questions
2
votes
3 answers

Non-Default parameter follows default parameters

I keep getting an error message on my function parameters. I've seen some other questions that are similar but I struggle to understand the answer and those people also had different situations which were more complex. def check(user_answer='',…
user11308226
2
votes
3 answers

R: purrr: using pmap for row-wise operations, but this time involving LOTS of columns

This is not a duplicate of questions like e.g. Row-wise iteration like apply with purrr I understand how to use pmap() to do a row-wise operation on a data-frame: library(tidyverse) df1 = tribble(~col_1, ~col_2, ~col_3, 1, 5, …
dain
  • 672
  • 1
  • 7
  • 22
2
votes
2 answers

How to pass information from one java class to another

I need to pass one parameter from one Java class(A) to another Java class(B). I use many solutions from the Internet but it couldn't solve my problem. The user will choose their answer from a list of radio button. The score will be added and I need…
Kim E. R
  • 73
  • 1
  • 8
2
votes
2 answers

Matlab: arrayfun, two matrices X,Y as components of the vector

Suppose that X, Y are the matrices of coordinates inside the given intervals xc = 0, yc = 0 xl = linspace(xc - 10, xc + 10, 2); yl = linspace(yc - 10, yc + 10, 2); [X,Y] = meshgrid(xl,yl); and fun is a handle to some function test(v) fun =…
justik
  • 4,145
  • 6
  • 32
  • 53
2
votes
2 answers

Pass and print all cases in an enum in Swift

Consider this simple enum: enum myEnum: String { case abc = "ABC" case xyz = "XYZ" } I want to write a function that can print all cases in an enum. Like.. printEnumCases(myEnum) Expected result: ABC XYZ Note: I can able to iterate an…
Confused
  • 3,846
  • 7
  • 45
  • 72
2
votes
5 answers

Is it bad practice to modify the variable within a method?

Which method style is better? Is it generally bad practice to modify the variable within a method? public class Person { public string Name { get; set;} } //Style 1 public void App() { Person p = new Person(); p.Name =…
Yeonho
  • 3,629
  • 4
  • 39
  • 61
2
votes
3 answers

Is it possible to pass a method body as a parameter in Java?

I am doing some android programming. I am adding buttons to a view. Each button has its own behaviour for its onClick function. But the code seems repetitive. For example: // the view View v = new View(this); // first button Button b1 = new…
Questionerer
  • 91
  • 1
  • 11
2
votes
4 answers

How to use `argparse` to pass arguments both from command line and from code?

I have a python program that takes in many arguments and run. With argparse, I can define the arguments, their default values, their explanations, and it can be used as a convenient container. So it's all good for passing arguments from command…
THN
  • 3,351
  • 3
  • 26
  • 40
2
votes
0 answers

How can I pass a list parameter to an ODBC query in Excel (Microsoft Query)

I'm having some trouble passing a particular type of parameter from an Excel cell value to an ODBC query. It's a DB2 database on an AS400 server, and I'm using the iSeries Access ODBC Driver from IBM. Here is the query with hard-coded…
2
votes
1 answer

How to have variables accessible across keyframes- AS3

I'm working on a portfolio suggestion application in Flash, which consists of two views: ask user for 3 to 4 points of information, and display recommendations based on that information. The first view is going swimmingly, as all I need are the…
Jason
  • 11,263
  • 21
  • 87
  • 181
2
votes
4 answers

Are array names in function arguments treated differently than arrays declared locally (auto)

Please read the comments in the program below : #include void test(char c[]) { c=c+2; //why does this work ? c--; printf("%c",*c); } int main() { char ch[5]={'p','o','u','r'}; //ch = ch+2; //this is definitely not…
Naveen
  • 7,944
  • 12
  • 78
  • 165
2
votes
1 answer

TSLint error for destructuring in function parameters

I would like to remove the tslint error I get on the following (in the object desctructuring parameter): export function renameProperty( oldProp: string, newProp: string, {[oldProp]: old, ...others} ): any { return { …
Kim Gentes
  • 1,496
  • 1
  • 18
  • 38
2
votes
3 answers

How to call a SQL Server procedure with both input and output parameters?

I'm trying to write a procedure which returns values on the basis of a select query result. Like find the ID of a user, use first name and last name to locate a user ID, and return the ID as an OUTPUT parameter. If more than one or no user is found,…
Diksha
  • 406
  • 5
  • 20
2
votes
1 answer

How to pass props from unrelated component

I need to plot a table using data from header component ( 2 drop-downs & one Apply button), while header, table section & footer are unrelated to each other I have tried to create an array in separate Utils file, which is populated when Apply…
ashish Kumar
  • 33
  • 1
  • 7
2
votes
2 answers

Ruby on Rails - passing the value of an input field to

Hi I am stuck here pretty bad. The senario is quite simple actually, I have an input field like this: %input.coupon_bar{:type => "text", :name=> "coupon", id=>"coupon_id"}/ And I want to pass whatever value is in that box to a different…
Umer Hassam
  • 1,332
  • 5
  • 23
  • 42