Is there a swap command in Blitz to swap the values of two variables? I.e Swap A,B? Or would I have to do C=A, A=B, B=C?
Swap command?
Blitz3D Forums/Blitz3D Beginners Area/Swap command? you could write your own function to do this if you really need to abbreviate the current method.
You are correct.
C=A
A=B
B=C
I'm not sure why you would need to except maybe a billboard with 10 lines of text.
For I = 1 to 9
Label(I)=Label(I+1)
Next I
Label(10) = "" ; Clear the last line
This scrolls the text up one line every time it's used assuming the Lables are printed in Ascending order.
You are correct.
C=A
A=B
B=C
I'm not sure why you would need to except maybe a billboard with 10 lines of text.
For I = 1 to 9
Label(I)=Label(I+1)
Next I
Label(10) = "" ; Clear the last line
This scrolls the text up one line every time it's used assuming the Lables are printed in Ascending order.
If you don't want to use an extra variable you can do this (it will swap a and b):
a=a*b
b=a/b
a=a/b
a=a*b
b=a/b
a=a/b
a=a*b
b=a/b
a=a/b
Although that can lead to rounding/floating point errors... b=a/b
a=a/b
and doesn't work so well with strings...