Page 2 of 2 <12
Topic Options
#150134 - 2005-10-19 03:34 PM Re: Splitting a String character-by-character
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Quote:


I did not know you could put the question mark at the end of the statement, why does that work?




That is topic creep but I did write a FAQ explaining it.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#150135 - 2005-10-19 03:42 PM Re: Splitting a String character-by-character
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
The use of the "?" is somewhat mysterious to new KiX Scripters, especially those used to its reference as a shortcut to the Print statement in various dialects of BASIC.

In KiX, the "?" is actually more like a shortcut to the @CRLF macro - it moves the current output devices to the beginning of a new line.

Anything placed on a line that is not an evaluated expression is simply output - a variable, a quoted string, etc.. they all continue to be displaye on the SAME line until a "?" or @CRLF is encountered. Depending on the state of the WrapAtEOL setting, the output line may wrap at the end of the screen.

Thus, in a loop, a simple status indication can be done by:
Code:
 Right('      ' + $Counter, 6) +Chr(13)


This prints the counter value, right justified in a 6 char field as a loop is processed. Since there's no "?" or @CRLF, the Chr(13) returns to the beginning of the same line, overprinting the line counter. You'll need a "?" at the end of the loop if you don't want to overprint the final counter value with the next output line.

You'll also see " ? ? " sometimes, or even " ? 'output' ? " to skip 2 lines, or a line before and after the output.

Hope this demystifies the "?"

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
Page 2 of 2 <12


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 302 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.051 seconds in which 0.023 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org