Array print
#1

Hi people,
Is it possible to print 2 dimensional array?

This is my array:
Код:
	//How can I print this below ↓
	new Array[][] = {"1", "2", "3", "4"};
Reply
#2

In an example as the above (let's say numbers are actual text), you only need to use the first dimension to access the data.

If it is related to numbers 1D array can be used (which is recommended).
Reply
#3

Okay, perhaps you do not understood me. I will make it 1D but how can I print the whole array like in PHP?

EDIT: Should I make a loop to loop thru all of the array data?
Reply
#4

pawn Код:
new b[] = {'1', '2', '3', '4'};
nothing is stopping you from doing:
pawn Код:
print(b);
which prints "1234". That's how strings work anyway.
Reply
#5

Okay this works with integers but how about characters?

Код:
	//This below only prints "Zero"
	new Array = {"Zero", "One", "Two", "Three"};
	print(Array);
there:
Reply
#6

That's a set of strings so you need to access each one from the 1st dimension.

Quote:
Originally Posted by bgedition
Посмотреть сообщение
EDIT: Should I make a loop to loop thru all of the array data?
I somehow missed that part. Yes, use a loop.
Reply
#7

Okay thank you for your time
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)