How to resolve the algorithm Keyboard input/Obtain a Y or N response step by step in the NetRexx programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Keyboard input/Obtain a Y or N response step by step in the NetRexx programming language

Table of Contents

Problem Statement

Obtain a valid   Y   or   N   response from the keyboard. The keyboard should be flushed, so that any outstanding key-presses are removed, preventing any existing   Y   or   N   key-press from being evaluated. The response should be obtained as soon as   Y   or   N   are pressed, and there should be no need to press an   enter   key.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Keyboard input/Obtain a Y or N response step by step in the NetRexx programming language

Source code in the netrexx programming language

/* NetRexx */

options replace format comments java crossref savelog symbols binary

Say 'Please enter Y or N'
parse ask c
Select
  when c='Y' Then Say 'YES'
  when c='N' Then Say 'NO'
  otherwise       Say 'Undecided'
  End

  

You may also check:How to resolve the algorithm Floyd-Warshall algorithm step by step in the Prolog programming language
You may also check:How to resolve the algorithm FizzBuzz step by step in the Brainf*** programming language
You may also check:How to resolve the algorithm Day of the week step by step in the Python programming language
You may also check:How to resolve the algorithm Fractran step by step in the Haskell programming language
You may also check:How to resolve the algorithm Arbitrary-precision integers (included) step by step in the 8th programming language