In a Drupal form there are three types of callback that are normally necessary to create a form:
- The form builder is the function that builds the form using an array the form API understands
- The form validation handler is the function that validates the values submitted from the users
- The form submission handler is the function that acts on the values submitted from the users
Of those functions, the one that outputs the result of the calculation done on the values submitted from the users is the last one. Normally, the form submission handler saves the data in the database, and show a message to the users through drupal_set_message(), but it could also simply show the result of the operations done on the entered data.
Since Drupal 7, the output of a form submission handler, as well as the output produced from a menu callback, can be a rendering array, and not a string. A rendering array has the pro of being easily altered from third-party modules through hook_page_build(), or hook_page_alter().
node_view() is an example of menu callback that returns a rendering array, and not a string.