Rebol Programming/confirm

From Wikibooks, open books for an open world
< Rebol Programming
Jump to navigation Jump to search

USAGE:[edit | edit source]

CONFIRM question /with choices 

DESCRIPTION:[edit | edit source]

Confirms a user choice.

CONFIRM is a function value.

ARGUMENTS[edit | edit source]

  • question -- Prompt to user (Type: series)

REFINEMENTS[edit | edit source]

  • /with
    • choices -- (Type: string block)

SOURCE CODE[edit | edit source]

confirm: func [
    "Confirms a user choice." 
    question [series!] "Prompt to user" 
    /with choices [string! block!] 
    /local yes no
    question: form question 
    if with [
        yes: "Yes" 
        no: "No" 
        if string? choices [yes: choices] 
        if all [block? choices not empty? choices] [
            either tail? next choices [yes: choices/1] [set [yes no] choices]
        question: reduce [question yes no]
    request/confirm question