---
title: "Why Erlang Shell always prints \"ok\" at the end of the output?"  
description: "Why Erlang Shell always prints \"ok\" at the end of the output?"  
author: "Tarun Kumar"  
published: 2016-03-09  
updated: 2020-09-22  
canonical: https://www.mindstick.com/interview/22998/why-erlang-shell-always-prints-ok-at-the-end-of-the-output  
category: "erlang"  
tags: ["erlang"]  
reading_time: 2 minutes  

---

# Why Erlang Shell always prints "ok" at the end of the output?

In the Erlang Shell the output **"ok"**indicates that the expression is executed successfully. The Erlang shell first of all reading an Erlang expression, and after evaluating it and then printing the result and looping for another expression.But the **io:fwrite()** function does two things. It prints out message "Good Morning" and after it returns the value **"ok"**.For example:when we execute **io:fwrite("Good Morning\n").** in the Erlang shell, the **fwrite** function prints "Good Morning" in the first line and the shell prints the return value **"ok"** in the next line (because we are using **\n** end of the "Good Morning" message.

## Answers

### Answer by Tarun Kumar

In the Erlang Shell the output **"ok"**indicates that the expression is executed successfully. The Erlang shell first of all reading an Erlang expression, and after evaluating it and then printing the result and looping for another expression.But the **io:fwrite()** function does two things. It prints out message "Good Morning" and after it returns the value **"ok"**.For example:when we execute **io:fwrite("Good Morning\n").** in the Erlang shell, the **fwrite** function prints "Good Morning" in the first line and the shell prints the return value **"ok"** in the next line (because we are using **\n** end of the "Good Morning" message.


---

Original Source: https://www.mindstick.com/interview/22998/why-erlang-shell-always-prints-ok-at-the-end-of-the-output

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
