True is -1:Code: QB64: [Select]
Further proof: True = NOT 0Code: QB64: [Select]
Or maybe this is what you want:Code: QB64: [Select]
Truth(-1) = “TRUE” Truth(0) = “FALSE”
I’m thinking that should work. If not, you’d just need to set a temp variable to hold the result first, before referencing it with your array.
Result = 5 < 15
PRINT Truth(Result)
Because I like to play with fire, I've defined TRUE to be 1 in my current program.
I forget why it seemed like a good idea. Probably because I think it's cool (and
short) to flip the status with var = var XOR 1.
Why it's playing with fire is that I must keep in mind that Boolean expressions
will still evaluate to -1.
For that I likeCode: QB64: [Select]I think I relearned from you!
toggle = 1 - toggle
and with that you don't mess with the Truth!
Or maybe this is what you want:Code: QB64: [Select]
Truth(-1) = “TRUE” Truth(0) = “FALSE”
I’m thinking that should work. If not, you’d just need to set a temp variable to hold the result first, before referencing it with your array.
Result = 5 < 15
PRINT Truth(Result)
Ho kiara87
See nearer the answer of Fellippe
There Is a clear transformation from your line 12 to his line 12.
In BASIC = Is both association like a =5, both comparison like in IF a = b THEN ....., When you do multiple assignment in the same line of code you must use parentesis.
z = 7 'start value
a = 0
for i=1 to 10
? chr$(asc("T")*-(a<>0)+asc("F")*-(a=0))+chr$(asc("R")*-(a<>0)+asc("A")*-(a=0))+chr$(asc("U")*-(a<>0)+asc("L")*-(a=0))+chr$(asc("E")*-(a<>0)+asc("S")*-(a=0))+chr$(asc("E")*-(a=0)), a, z
z = z xor (7 xor 19)
a = a xor (0 xor not 0)
next
Vince's toggle method is neat, and new to me. It
even works for flipping between 0 and 1. But it
does incur 3 register loads and 2 register operations.