
-----------------------------------
Clayton
Wed Jan 25, 2006 3:38 pm

records
-----------------------------------
i asked my teacher about records and he couldnt tell me anything about them, i looked in the turing directory and found it confusing, ditto with the online tutorials can ne1 plz help explain them too me

-----------------------------------
person
Wed Jan 25, 2006 3:47 pm


-----------------------------------
http://www.compsci.ca/v2/viewtopic.php?t=9636

a record is a basically a user defined type, this means we are no longer restricted to things like ints and strings

i know wat im saying is basically wat the tutorial above said, but can u post wat u dont get about it?

-----------------------------------
Clayton
Wed Jan 25, 2006 3:51 pm


-----------------------------------
i basically dont understand how i can use them and how to use them

-----------------------------------
Delos
Wed Jan 25, 2006 3:54 pm


-----------------------------------
And hence you read that Tut, which, I might add, is one of the best tuts around.  It'll have you compacting your code in no time.

-----------------------------------
Clayton
Wed Jan 25, 2006 3:58 pm


-----------------------------------
And hence you read that Tut, which, I might add, is one of the best tuts around.  It'll have you compacting your code in no time.
did you not read my message, i didnt understand the tut, so i need some1 to explain it to me in other terms

-----------------------------------
person
Wed Jan 25, 2006 5:19 pm


-----------------------------------
did you not read my message, i didnt understand the tut, so i need some1 to explain it to me in other terms

did you not read my message, wat didnt u understand about it?

-----------------------------------
MysticVegeta
Wed Jan 25, 2006 6:09 pm


-----------------------------------

did you not read my message, wat didnt u understand about it?
did you not read his message?
i basically dont understand how i can use them and how to use them

-----------------------------------
person
Wed Jan 25, 2006 6:12 pm


-----------------------------------
do u not understand that its a pretty vague thing to say, and the tut explains all that

-----------------------------------
Andy
Wed Jan 25, 2006 6:13 pm


-----------------------------------
http://www.compsci.ca/v2/viewtopic.php?t=2325 there's another tutorial..

-----------------------------------
Clayton
Thu Jan 26, 2006 12:21 am


-----------------------------------
thank you that helps me alot i didnt see that there b4 thnx again

-----------------------------------
iker
Thu Jan 26, 2006 4:49 pm


-----------------------------------
Also, you can write a record as a whole to a file, instead of every single variable, and save many lines...

so for example instead of

var x, y, z : int
x := 9
y := 10
z := 15
var a, b, c : string
a := "a"
b := "b"
c := "c"
var fileNo : int
open : fileNo, "filename.txt", write
write : fileNo, x
write : fileNo, y
write : fileNo, z
write : fileNo, a
write : fileNo, b
write : fileNo, c
close : fileNo

you can have

type ter :
    record
        x : int
        y : int
        z : int
        a : string
        b : string
        c : string
    end record
var let : ter
let.x := 9
let.y := 10
let.z := 15
let.a := "a"
let.b := "b"
let.c := "c"
var fileNo : int
open : fileNo, "filename.txt, write
write : fileNo, let
close : fileNo

now, even though there are 3 more lines with a record, you don't have to risk forgetting to write one of the variables since all of them are included in writeing a record

-----------------------------------
Clayton
Thu Jan 26, 2006 10:35 pm


-----------------------------------
ok thnx i think im starting to understand now
