# The printing function is not working in https://try.ocamlpro.com/

**URL:** <https://discuss.ocaml.org/t/the-printing-function-is-not-working-in-https-try-ocamlpro-com/942>\
**Category:** Learning\
**Created:** [October 10, 2017, 6:56pm UTC](https://discuss.ocaml.org/t/the-printing-function-is-not-working-in-https-try-ocamlpro-com/942 "2017-10-10T18:56:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ranamustafa](https://avatars.discourse-cdn.com/v4/letter/r/dec6dc/32.png) [@ranamustafa](https://discuss.ocaml.org/u/ranamustafa)\
**Post date:** [October 10, 2017, 6:56pm UTC](https://discuss.ocaml.org/t/the-printing-function-is-not-working-in-https-try-ocamlpro-com/942/1 "2017-10-10T18:56:15Z")

</div>

Hi  
why this function is not printing and working . i want to use it to print the numbers  
let x=5  
Printf.printf " the value of x=%d"  
Returen of this function is unit ()

---

<div class="post-metadata">

**Author:** ![jeffsco](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/jeffsco/32/45_2.png) [@jeffsco](https://discuss.ocaml.org/u/jeffsco)\
**Post date:** [October 10, 2017, 6:58pm UTC](https://discuss.ocaml.org/t/the-printing-function-is-not-working-in-https-try-ocamlpro-com/942/2 "2017-10-10T18:58:33Z")

</div>

The return value always going to be `()`. But this is different from what gets printed. Sometimes in the toplevel (REPL), they get mixed together. But also you didn’t pass `x` to the function.

```
val x : int = 5
# Printf.printf " the value of x=%d";;
- : int -> unit = <fun>
# Printf.printf " the value of x=%d" x;;
the value of x=5- : unit = ()
```

---

<div class="post-metadata">

**Author:** ![ranamustafa](https://avatars.discourse-cdn.com/v4/letter/r/dec6dc/32.png) [@ranamustafa](https://discuss.ocaml.org/u/ranamustafa)\
**Post date:** [October 10, 2017, 7:06pm UTC](https://discuss.ocaml.org/t/the-printing-function-is-not-working-in-https-try-ocamlpro-com/942/3 "2017-10-10T19:06:07Z")

</div>

Hi, thank for your reponse  
i can not undersatnd why when i put the same code is not working

# Printf.printf “the value of function x=%d” x;;

- : unit = ()

i am using [https://try.ocamlpro.com/](https://try.ocamlpro.com/) to use my code on online ocaml

---

<div class="post-metadata">

**Author:** ![smondet](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/smondet/32/111_2.png) [@smondet](https://discuss.ocaml.org/u/smondet)\
**Post date:** [October 10, 2017, 7:21pm UTC](https://discuss.ocaml.org/t/the-printing-function-is-not-working-in-https-try-ocamlpro-com/942/4 "2017-10-10T19:21:08Z")

</div>

funny thing, it seems that printf in [try.ocamlpro.com](http://try.ocamlpro.com) prints to the  
Javascript console (and not to the REPL)

 ![](https://us1.discourse-cdn.com/flex020/uploads/ocaml/original/1X/9d58e508f879c60d626fc4fa3415ca402a105960.png)

​

---

<div class="post-metadata">

**Author:** ![ranamustafa](https://avatars.discourse-cdn.com/v4/letter/r/dec6dc/32.png) [@ranamustafa](https://discuss.ocaml.org/u/ranamustafa)\
**Post date:** [October 10, 2017, 7:22pm UTC](https://discuss.ocaml.org/t/the-printing-function-is-not-working-in-https-try-ocamlpro-com/942/5 "2017-10-10T19:22:46Z")

</div>

> [@jeffsco](#):
>
> "

thank you very much its not my fault
