This is virtually right out of the book.
Why am I getting these error messages?
Xojo seems to be inherently buggy. e.g. if I change the format in an edit field, they add up differently.
a method is managed by xojo, remove the sub and end sub line.
if you copy a method (via context menu over the name) then this source is complete in the clipboard.
What you are seeing is the external format of the code. The IDE provides the sub/end sub part for you.
“Sub DoublePlusTen(aNumber as Integer)”
means
Type “DoublePlusTen” into the Method Name field
Type “aNumber as Integer” into the Parameters field
“end sub” is provided by the IDE automatically. You don’t need to type it anywhere.
Thank you, I am familiar with that approach.
I was curious why they present this as a coding example if it does not work.
Xojo in many ways helps you in developing faster. What you see in the IDE is the body of the method DoublePlusTen. But the compiler is fetched the complete code, what you see in your screen capture.
Remove the first and last lines, it will compile fine. Then print the method, you will see the complete code !
*The IDE
Or highlight the working method in the project editor on the left, copy, then paste into something like a text editor. The result will be similar to the sample code in the docs.