How to resolve the algorithm Case-sensitivity of identifiers step by step in the REXX programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Case-sensitivity of identifiers step by step in the REXX programming language

Table of Contents

Problem Statement

Three dogs (Are there three dogs or one dog?) is a code snippet used to illustrate the lettercase sensitivity of the programming language. For a case-sensitive language, the identifiers dog, Dog and DOG are all different and we should get the output: For a language that is lettercase insensitive, we get the following output:

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Case-sensitivity of identifiers step by step in the REXX programming language

Source code in the rexx programming language

/*REXX program demonstrate  case insensitivity  for  simple  REXX  variable names.      */

  /*  ┌──◄── all 3 left─hand side REXX variables are identical (as far as assignments). */
  /*  │                                                                                 */
  /*  ↓                                                                                 */
     dog= 'Benjamin'                             /*assign a   lowercase   variable (dog)*/
     Dog= 'Samba'                                /*   "   "  capitalized     "      Dog */
     DOG= 'Bernie'                               /*   "   an  uppercase      "      DOG */

                              say center('using simple variables', 35, "─")     /*title.*/
                              say

if dog\==Dog | DOG\==dog  then say 'The three dogs are named:'     dog"," Dog 'and' DOG"."
                          else say 'There is just one dog named:'  dog"."

                                                 /*stick a fork in it,  we're all done. */


/*REXX program demonstrate case sensitive REXX  index  names  (for compound variables). */

 /*  ┌──◄── all 3 indices (for an array variable)  are unique  (as far as array index). */
 /*  │                                                                                  */
 /*  ↓                                                                                  */
x= 'dog';  dogname.x= "Gunner"                   /*assign an array index,  lowercase dog*/
x= 'Dog';  dogname.x= "Thor"                     /*   "    "   "     "   capitalized Dog*/
x= 'DOG';  dogname.x= "Jax"                      /*   "    "   "     "     uppercase DOG*/
x= 'doG';  dogname.x= "Rex"                      /*   "    "   "     "       mixed   doG*/

                              say center('using compound variables', 35, "═")   /*title.*/
                              say

_= 'dog';  say "dogname.dog="  dogname._         /*display an array index, lowercase dog*/
_= 'Dog';  say "dogname.Dog="  dogname._         /*   "     "   "     "  capitalized Dog*/
_= 'DOG';  say "dogname.DOG="  dogname._         /*   "     "   "     "    uppercase DOG*/
_= 'doG';  say "dogname.doG="  dogname._         /*   "     "   "     "      mixed   doG*/

                                                 /*stick a fork in it,  we're all done. */


  

You may also check:How to resolve the algorithm Dot product step by step in the Ruby programming language
You may also check:How to resolve the algorithm Joystick position step by step in the Action! programming language
You may also check:How to resolve the algorithm Shoelace formula for polygonal area step by step in the min programming language
You may also check:How to resolve the algorithm Sort numbers lexicographically step by step in the Tcl programming language
You may also check:How to resolve the algorithm Show the epoch step by step in the Arturo programming language