# Returning a Function - Different Result

**URL:** <https://forums.kodeco.com/t/returning-a-function-different-result/143220>\
**Category:** Dart Apprentice\
**Created:** [June 30, 2021, 7:58am UTC](https://forums.kodeco.com/t/returning-a-function-different-result/143220 "2021-06-30T07:58:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vim](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/vim/32/81494_2.png) [@vim](https://forums.kodeco.com/u/vim)\
**Post date:** [June 30, 2021, 7:58am UTC](https://forums.kodeco.com/t/returning-a-function-different-result/143220/1 "2021-06-30T07:58:54Z")

</div>

Hi, in the “Returning a Function” section of Dart Apprentice v1.1.0 PDF (page 123), the output of:

```
print(triple(6));
print(triple(14.0));

```

are:

```
18
42.0

```

But mine are:

```
18
42

```

I’ve checked the code I typed several times but cannot find any typo in it. Any idea what might cause the problem (assuming it is a problem)?

By the way I am using Dartpad based on Flutter 2.2.2 Dart SDK 2.13.3 with Null Safety ON (assuming this matters).

Thank you in advance for taking the time to answer my question.

---

<div class="post-metadata">

**Author:** ![suragch](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/suragch/32/109020_2.png) [@suragch](https://forums.kodeco.com/u/suragch)\
**Post date:** [June 30, 2021, 8:30am UTC](https://forums.kodeco.com/t/returning-a-function-different-result/143220/2 "2021-06-30T08:30:37Z")

</div>

This is due to the fact that on the web (which includes DartPad) all Dart code is compiled to JavaScript. Since JavaScript does not differentiate `int` and `double` (everything is `double`), `42.0` is just displayed as `42`. If you were to run the same code in VS Code, you would see `42.0`.

---

<div class="post-metadata">

**Author:** ![vim](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/vim/32/81494_2.png) [@vim](https://forums.kodeco.com/u/vim)\
**Post date:** [July 1, 2021, 1:25am UTC](https://forums.kodeco.com/t/returning-a-function-different-result/143220/3 "2021-07-01T01:25:50Z")

</div>

I see… Thank you for your answer, much appreciated.
