NewBie's Corner Session 3 More Read and Write commands & Multiple commands
Welcome to NewBie's Corner, a weekly or biweekly post covering basic Caché Material.
Click on the Caché Cube in your system tray and select Terminal to try out the commands.
Write command with carriage return and line feed
When the exclamation point "!" is inserted after a Write command, a carriage return and line feed combination is produced. Note in this example, that a comma separates the exclamation point from the variable "X".
Set X=12
Write !,X
; carriage return and line feed inserted here
12
Multiple variables may be set with one Set command and the Write command does the same
Set X=12,Y=13,Z=14 ;single Set command with variables separated by commas
Write X,Y,Z ;single Write command with multiple variables
121314
Now here is where the carriage return and line feed come in
Write !,X,!,Y,!,Z
12
13
14
Other Read and Write operators
Exclamation point (!) – Inserts a carriage return / line feed (already shown)
Hash symbol (#)
The Hash symbol or pound sign (#) serves two purposes:
Write # - inserts a formfeed
Write #,"Just after a formfeed"
Read – limits the number of characters' read
Read entry#5 ; will accept the first 5 characters only
Integer required
Question mark (?) - Write advancing a number of spaces from the beginning of the line
Write ?10,"Now is the time" ; will start writing at column 10
Integer required
Colon (:) - Read command timer
Read entry:5 ; will only wait 5 seconds before terminating read
Integer required
--Mike Kadow
If you have a comment, please respond through the InterSystems Developer Community, don't send me private email. Unless of course you wish to address me only.
See NewBie Index for an index of all NewBie Corner posts.
Just a play:
Here you're having a counter which counts within the terminal's same line
SAMPLES>for i=1:1:10 hang 0.5 write $C(13),?10,i
10