Interesting Hugo behavior

This is a discussion / support forum for the Hugo programming language by Kent Tessman. Hugo is a powerful programming language for making text games / interactive fiction with multimedia support.

Hugo download links: https://www.generalcoffee.com/hugo
Roody Yogurt's Hugo Blog: https://notdeadhugo.blogspot.com
The Hugor interpreter by RealNC: http://ifwiki.org/index.php/Hugor

Moderators: Ice Cream Jonsey, joltcountry

User avatar
Tdarcos
Posts: 7758
Joined: Fri May 16, 2008 9:25 am
Location: Arlington, Virginia
Contact:

Interesting Hugo behavior

Post by Tdarcos »

See if you can figure out what will happen without compiling. (Okay, I cheated, but if I hadn't tried compiling and running it I'd never have found out what it was doing.)

Code: Select all

verb "x2"
	*                                DoX2

verb "x3"
  *                                DoX3

verb "x2"
  *                                DoX22

verb "x3"
  *                                DoX32

verb "x3"
    *                                DoX33

verb "x4"
  *                                DoX4
  
  
outine DoX2
{
  "For X2, the first routine was used."
  return true
}

routine DoX22
{
  "For X2, the second routine was used."
  return true
}

routine DoX3
{
  "For X3, the first routine was used."
  return true

}

routine DoX32
{
  "For X3, the second routine was used."
  return true

}

routine DoX33
{
  "For X3, the third routine was used."
  return true
}

routine DoX4
{
  "For X4, the first routine was used."
  return true
}
Now the questions:
  1. Which routine does verb X2 call?
  2. Does X3 compile without error?
  3. If so, which routine does verb X3 call?
  4. What is the result if routine DoX4 is changed to replace DoX4
Remember, I already know the answers, I want to see how you think.
"And that's why I've traveled far, 'cause I come so together where you are."
- Bob Welch, Sentimental Lady