# Generating Arguments in Functions

**URL:** <https://discourse.processing.org/t/generating-arguments-in-functions/19859>\
**Category:** Coding Questions\
**Tags:** homework\
**Created:** [April 17, 2020, 5:26am UTC](https://discourse.processing.org/t/generating-arguments-in-functions/19859 "2020-04-17T05:26:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![confusedstudent](https://avatars.discourse-cdn.com/v4/letter/c/c89c15/32.png) [@confusedstudent](https://discourse.processing.org/u/confusedstudent)\
**Post date:** [April 17, 2020, 5:26am UTC](https://discourse.processing.org/t/generating-arguments-in-functions/19859/1 "2020-04-17T05:26:33Z")

</div>

Hello! I need some help with functions.  
My teacher has asked,

“Write a function named distance that accepts a vehicle’s speed and time as arguments, and  
returns the distance the vehicle has traveled.”

> I am able to create functions with the double format, return values, but I am not sure how to generate arguments in functions. Please help!

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [April 17, 2020, 6:04am UTC](https://discourse.processing.org/t/generating-arguments-in-functions/19859/2 "2020-04-17T06:04:02Z")

</div>

Arguments here is a different word for **parameters**.

So this is your function header :

```auto
float distance (float speed, float time){

}

```

You don’t “generate arguments” but you return the result based on them.

In the function calculate the distance and return it. You could get the speed in meters per second and the time in seconds.

You call the function from `setup()` with `println(distance (30,10));`

_And welcome to the forum!_

_Great to have you here!_

Warm regards,

Chrisir

---

<div class="post-metadata">

**Author:** ![confusedstudent](https://avatars.discourse-cdn.com/v4/letter/c/c89c15/32.png) [@confusedstudent](https://discourse.processing.org/u/confusedstudent)\
**Post date:** [April 20, 2020, 8:58pm UTC](https://discourse.processing.org/t/generating-arguments-in-functions/19859/3 "2020-04-20T20:58:55Z")

</div>

Thank you! This is really helpful.
