Local Variables That Give a Value to an Array and the Size
Author |
Message |
TheXploder
|
Posted: Wed Jan 28, 2004 12:33 pm Post subject: Local Variables That Give a Value to an Array and the Size |
|
|
I'm trying to make a check for words, and with each same procedure check different words and enable bigger arrays:
code: |
proc words (size : int, name1, name2 : string)
var word : array 1 .. size of string := init (name1, name2)
for i : 1 .. size
if word (i) = "Xploder" then
put "Name matches!"
else
put "Name doesn't match!"
end if
end for
end words
words (2, "Xploder", "TheXploder")
words (3, "Cool", "Uncool", "TheXploder")
|
It doesn't seem to work quite right... hope you get where I am going with this, could you please hlep me out... |
|
|
|
|
|
Sponsor Sponsor
|
|
|
TheXploder
|
Posted: Wed Jan 28, 2004 12:49 pm Post subject: (No subject) |
|
|
ohh, fixed it:
code: |
proc words (size : int, name1, name2 : string)
var word : array 1 .. size of string
word (1) := name1
word (2) := name2
for i : 1 .. size
if word (i) = "Xploder" then
put "Name matches!"
else
put "Name doesn't match!"
end if
end for
end words
words (2, "Xploder", "TheXploder")
|
|
|
|
|
|
|
Paul
|
Posted: Wed Jan 28, 2004 12:53 pm Post subject: (No subject) |
|
|
Yay! way to go self-help... |
|
|
|
|
|
we64
|
Posted: Wed Jan 28, 2004 1:47 pm Post subject: (No subject) |
|
|
yeah good job |
|
|
|
|
|
|
|