bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#59612: A comment line in example change


From: Milan Zimmermann
Subject: bug#59612: A comment line in example change
Date: Sat, 26 Nov 2022 10:59:13 -0500

The script I provided has a mis-typed comment on line 6. The script should be:

################################################################
# The behavior of conditionals depends on whitespace
# Source this script to test it

# This formatting works as expected; evaluates the "true" block.
# Result:
#  "It is 2" # <=== The original had a typo here, included NOT
#

if { = 2 2 } {
  echo "It is 2"
} {
   echo "It is NOT 2"
}

# This formatting causes a BUG: both the "true" block and the "false" block are evaluated.
# I tried several combinations, it appears it the "false" block starts on it's own line,
# it is no longer treated a part of the "if" _expression_. Which could be argued
# is expected because there is no "else" that would define whether the second block
# is not part of the "if" _expression_. BUT see next test
#
# Result:
#  "It is 3"
#  "It is NOT 3"
#

if { = 3 3 } {
   echo "It is 3"
}
{
   echo "It is NOT 3"
}

# BUT we get the same incorrect result if we place the whole if _expression_ into {}
{
  if { = 4 4 } {
     echo "It is 4"
  }
  {
     echo "It is NOT 4"
  }
}
######################################################################


reply via email to

[Prev in Thread] Current Thread [Next in Thread]