Computer Science Canada

VERY SIMPLE PUT PROBLEM

Author:  Boarder16 [ Mon Jan 12, 2004 3:31 pm ]
Post subject:  VERY SIMPLE PUT PROBLEM

Hey this is a seperate project(not skewl related) i am workign on... i made a veriable(string) and i give it a value with LOTS of text... i want it to show like this when icall it to put...

balance 564
subtraction 34
balance 520

so on... i jsut want to know is when igive th variable a text value do i HAVE to put it like this....

text:= "balance 564 subtraction 34 balance 520"
where there are lots of spaces so it shwos it on teh next line, or is tehre a way ican do sumthign where i type it ut liek this...

put "balance 564
subtraction 34
babalala so on....
and it wil give that value to the variable???

Author:  Thuged_Out_G [ Mon Jan 12, 2004 4:03 pm ]
Post subject: 

i dont think so...use an array or a variable for each line of text
there might be a way to put an amount of characters from the variable to the string

put (length(word)-10)

that might give you everything but the last characters(MIGHT)
im not positive on that

Author:  McKenzie [ Mon Jan 12, 2004 4:21 pm ]
Post subject: 

% \n is the newline character
put "Hey\nThis\nis\ncool\n"

Author:  Boarder16 [ Mon Jan 12, 2004 4:53 pm ]
Post subject: 

holy sh*t i never knew that thanks a lot.. this will save me tones of time..

thanks 8)

Author:  DanShadow [ Mon Jan 12, 2004 6:51 pm ]
Post subject: 

hmm! I thought \n was only used in the 'C' language, lol! tx, Ill probably end up using that if I go back from graphical programming.

Author:  Andy [ Mon Jan 12, 2004 8:05 pm ]
Post subject: 

well turing compiles into C then does work there... but why use that when u have skip?

Author:  AsianSensation [ Mon Jan 12, 2004 8:06 pm ]
Post subject: 

cuz skip and \n are the exact same thing.

Author:  Thuged_Out_G [ Tue Jan 13, 2004 3:07 pm ]
Post subject: 

well, skip has other uses, like when your reading from a file

code:

var stream:int
var line:string

open:stream,"file.txt",get
assert stream>0

loop
get:stream,skip   %skip all whitespace in the document
get:stream,line:*
exit when eof(stream)
end loop

Author:  AsianSensation [ Tue Jan 13, 2004 5:57 pm ]
Post subject: 

not really, when reading from a txt file, unless you did this:

code:
get: filein, word :*


then it would get all the stuff up to any white spaces, and stop there, and I am pretty sure instead of using skip, you can just use '\n' instead.


: