Computer Science Canada Actually writing code question; Turing |
Author: | Flikerator [ Wed Oct 25, 2006 3:30 pm ] | ||||
Post subject: | Actually writing code question; Turing | ||||
I have data declaration for lines. I want to declared all the four points (x1,y1,x2,y2) on one line. I thought about using the semi colin. This ";" It worked. BUT when I hit F2 it puts it on the next line x__x Is there a way to keep it all on the same line? This
Becomes
I want it to stay as the first one |
Author: | Clayton [ Wed Oct 25, 2006 4:13 pm ] |
Post subject: | |
what's wrong with it all being on seperate lines? all it does when it is on one line is make your code harder to read. |
Author: | iamcow [ Wed Oct 25, 2006 4:34 pm ] |
Post subject: | |
if you're doing that for the sake of shortening your program, you might as well not do it. It's till the same amount of optimization as the one lined thing |
Author: | Flikerator [ Wed Oct 25, 2006 5:08 pm ] |
Post subject: | |
Its not hard to read for me. I have many "Lines" and each one has 9 different pieces of information (I included the basic 4). It wastes room; I hate scrolling around to go around changing things if there is a better way. If I could do it in 1, that saves me 8 lines. Then I don't need to white space it. If there isn't a way Ill simple use files. If there is a way I would like to know; even if I'm not going to use it. Why deny information simply because you 'think' at this moment it isn't as good? Catalogue it; you may find a use for it later that you never thought of before. |
Author: | ericfourfour [ Wed Oct 25, 2006 5:28 pm ] | ||
Post subject: | |||
How about having your line as an object? Hasn't been tested.
|
Author: | [Gandalf] [ Wed Oct 25, 2006 9:40 pm ] | ||
Post subject: | |||
Or more generally you could create something like so:
|
Author: | Clayton [ Thu Oct 26, 2006 9:08 am ] | ||
Post subject: | |||
or better yet, instead of making a procedure that mercilessly changes the value of lines(x), make it a function which creates a new value to assign to lines(x)
|
Author: | Flikerator [ Thu Oct 26, 2006 11:08 am ] |
Post subject: | |
I never thought of it that way. Thanks for the help. If anyone knows how to knows how to make it so you can write the code on one line let me know, im still interested in that ^_^ |
Author: | Clayton [ Thu Oct 26, 2006 1:04 pm ] |
Post subject: | |
like i said before, it is bad coding practice, makes your code harder to read, and generally just doesnt look good anyway. The way you had it at the start "works", its just that when you hit F2, it indents the code to its standards, ie, only one declaration per line (ie linex1 := 2), using something like [Gandalf]'s procedure, or better yet my function is going to be your best bet. |