#202480 - 2011-06-21 12:01 PM
Am I going crazy or is it a bug?
|
Jeroen
Starting to like KiXtart
Registered: 2001-08-16
Posts: 180
Loc: Netherlands
|
Hi Guys,
Tell me - am I going crazy?
Cls
Break on
At (3,3)"Test1"
Get $
Exit
$null = MessageBox("TEST","TEST",4160)
I would expect this code to generate "Test1" as output to the screen, and then to exit the script after I press a button. Instead, it also shows the messagebox... ??
If I change the code to:
Cls
Break on
At (3,3)"Test1"
Get $
Exit
At (4,3)"Test2"
Get $
$null = MessageBox("TEST","TEST",4160)
Then it does exactly what I would expect: output only "Test1" to the screen and exit.
_________________________
Regards, Jeroen.
There are two ways to write error-free programs. Only the third one works.
|
|
Top
|
|
|
|
#202482 - 2011-06-21 12:11 PM
Re: Am I going crazy or is it a bug?
[Re: Jochen]
|
Jeroen
Starting to like KiXtart
Registered: 2001-08-16
Posts: 180
Loc: Netherlands
|
But the exit code is optional isn't it ?
_________________________
Regards, Jeroen.
There are two ways to write error-free programs. Only the third one works.
|
|
Top
|
|
|
|
#202483 - 2011-06-21 12:14 PM
Re: Am I going crazy or is it a bug?
[Re: Jeroen]
|
Jeroen
Starting to like KiXtart
Registered: 2001-08-16
Posts: 180
Loc: Netherlands
|
Or at least, that is what I understood from:
"If EXIT is followed by a numeric expression, then @ERROR is set to the value of that expression and you can check it in the calling script or batchfile."
_________________________
Regards, Jeroen.
There are two ways to write error-free programs. Only the third one works.
|
|
Top
|
|
|
|
#202486 - 2011-06-21 05:08 PM
Re: Am I going crazy or is it a bug?
[Re: Jeroen]
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Short answer - no, it's not optional. Also applies to QUIT. Don't believe the manual, it tells half-truths.
Long answer - yes it is optional BUT in some cases the code following the Exit will be interpreted as the optional parameter. This is because KiXtart is a free format language and newlines don't have any special meaning so the first bit of code on the next line becomes the parameter. When this happens the code "disappears".
I think we may have a FAQ for this, it used to come up a lot usually with misbehaving conditional constructs.
Exiting without setting a status is a really bad habit anyway, so consider it mandatory.
[edit]Found the FAQ, getting a bit long in the tooth but here it is: http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Board=5&Number=130059 [/edit]
|
|
Top
|
|
|
|
#202504 - 2011-06-24 02:03 PM
Re: Am I going crazy or is it a bug?
[Re: Les]
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Any example that contains GOSUB is going to have the kids asking "what era are you, like, from daddy-o" 
Maybe venerable would have been better. No?
|
|
Top
|
|
|
|
#202506 - 2011-06-24 05:06 PM
Re: Am I going crazy or is it a bug?
[Re: Les]
|
BradV
Seasoned Scripter
  
Registered: 2006-08-16
Posts: 687
Loc: Maryland, USA
|
They kept talking about the "free love," but I never even got "free like."
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 1782 anonymous users online.
|
|
|