Create a variable equal to the current value of another variable (create a constant)
#2

pawn Code:
new x=2;
new y;
y=x;
printf("x==%i | y==%i", x, y);
x=5;
printf("x==%i | y==%i", x, y);
If I'm not wrong x will change its value and y won't.
y is a variable though; does it have to be a constant? If yes, why?

#Edit#:
I've just tried it out and you obviously can also use a constant for that. Code for that:
pawn Code:
new x = 2;
new const y = x;
printf("x==%i | y==%i", x, y);
x=6;
printf("x==%i | y==%i", x, y);
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)