Logtalk reference manual
Built-in method: ask_question/5
Contents > Reference Manual > Built-in Methods > ask_question/5

## ask_question/5

#### Description

    ask_question(Question, Kind, Component, Check, Answer)

Built-in method for asking a question represented by a term, `Question`, which is converted to the question text using the `logtalk::message_tokens(Question, Component)` hook predicate. This method is declared in the `logtalk` built-in object as a public predicate. The default question prompt and the input stream used for each `Kind-Component` pair can be found using the `logtalk::question_prompt_stream(Kind, Component, Prompt, Stream)` hook predicate. The `Check` argument is a closure that is converted into a checking goal by extending it with the user supplied answer. This predicate implements a read-loop that terminates when the checking predicate succeeds.

This predicate starts by calling the `logtalk::question_hook(Question, Kind, Component, Check, Answer)` hook predicate. If this predicate succeeds, the `ask_question/5` predicate assumes that the question have been successfully asked and replied.

#### Template and modes

    ask_question(+nonvar, +nonvar, +nonvar, +callable, -term)

#### Meta-predicate template

    ask_question(*, *, *, 1, *)

#### Errors

`(none)`

#### Examples

    ...,
    logtalk::ask_question(enter_age, question, my_app, integer, Age),
    ...

#### See also

`question_hook/6`, `question_prompt_stream/4`
`message_hook/4`, `message_prefix_stream/4`, `message_tokens//2`, `print_message/3`, `print_message_tokens/3`, `print_message_token/4`