|
||||||
| Java Help Java Help forum discussing all Java platforms - J2ME, J2SE and J2EE - as well as relevant standards, APIs and frameworks such as Swing, Servlets, JSPs, Applets, Struts, Spring, Hibernate, ANT, EJB, and other Java-related topics. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
What are arguments? I'm pretty sure that every programming language has arguments (right?) but what are they? Are they a specific kind of function, or is it a term that covers a lot of functions?
|
| Sponsored Links |
|
|
|
|||||
|
An argument is a piece of information that you give to a function to work with. Depending on the argument passed, it may or may not be changed by the function.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall |
|
|||
|
So could you pass an argument through a lot of functions, and only some of the functions would affect it, while others would not? For some reasons, this reminds me of a catalyst, although it is very different from one.
|
|
|||||
|
If you have nested function calls, and each one passes it on to the next in the function call, yes. However, you would probably need to send it as changeable all the way down, even if some of the functions don't change it.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall |
|
|||||
|
Are you familiar with how functions work?
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall |
|
|||
|
Quote:
Code:
void printFunction(String argument){
System.out.println(argument);
}
Code:
String data = "hello world"; printFunction(data); The talk of nested function calls isn't really important. it would just be, for example, printFunction having the following code: Code:
void printFunction(String argument){
printWord(argument);
}
|
|
|||||
|
Functions in programming work a lot like they do in math, except programming functions get better names that f() or g().
In math, when you say f(x) = 2x, you are defining a rule: for input x, output 2 times x. In programming you have the same idea, except it can be more complicated. Because we have various data types (float, int, etc) you need to be precise about the input and output when you define your function. Also, they can do a lot more complicated stuff. Code:
float f(float x)
{
float temp;
temp = 2*x;
return temp;
}
----- If we look at g(x) = 2 sqrt(x), things get more complicated. Code:
float g(float x)
{
float temp;
temp = 2*sqrt(x);
return temp;
}
float sqrt(float x)
{
// do something
}
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Arguments in Perl | smith | Perl | 3 | 06-08-2007 09:39 PM |
| Build Arguments | Chan | C# Programming | 1 | 05-03-2007 11:53 AM |
| John | ........ | 223.00000 |
| dargueta | ........ | 168.00000 |
| Xav | ........ | 164.00000 |
| gaylo565 | ........ | 18.00000 |
| WingedPanther | ........ | 15.00000 |
| |pH| | ........ | 15.00000 |
| Johnnyboy | ........ | 3.00000 |
| navghost | ........ | 1.00000 |
Goal: 100,000 Posts
Complete: 65%