# Weird print thing. PRINT R=RND(3999)

1

CLIGUI 2024-08-17 22:58 (Edited)

R=0

PRINT R=RND(3999)
PRINT R
TEXT 0,2, ""+STR\$(R)+""
NUMBER 15,0,R,5

All four will say R=0, but change the R to 3 and PRINT R=RND(3999) will still say 0.

CLIGUI 2024-08-17 23:08 (Edited)

I thought this was because it would only print if R=0, but this is not the case, because if you change the R in R=RND to another variable it will say R is not initialized.

CLIGUI 2024-08-17 23:16

PRINT RND(9)=0 however will do nothing.

Pablo 2024-08-18 02:20 (Edited)

I rewrote your example to illustrate it's behaviour:

``````R=0

IF R=RND(3999) THEN
RET = -1
ELSE
RET = 0
END IF
PRINT RET

PRINT R
TEXT 0,2, ""+STR\$(R)+""
NUMBER 15,0,R,5``````

was8bit 2024-08-18 04:14

@cligui…
It is because the equation with the = symbol will cause lowresnx to render it as a true/false and therefore yield a true false

Try this…

R=0

PRINT R=RND(3999)
PRINT R
TEXT 0,2, ""+STR\$(R)+""
NUMBER 15,0,R,5

PRINT 1=2
PRINT 1=1

PRINT R=R

was8bit 2024-08-18 04:17

You may also do this to temporarily disable a section of code…

IF 0 then

End if

was8bit 2024-08-18 04:19

When you write

IF A=B then

LowRes converts A=B to a 0 or -1

was8bit 2024-08-18 04:21

PRINT (1=1) + (3=3)

Will print
-2