Most programming languages uses = to copy a value into whatever whatever you put on the left side. You did it with TooClose, which you set to true.
But when you compare values as you do with the if statement, you need another operator, otherwise CanReadThis will be set to true and the if statement will always run (or syntax error), making it unnecessary.
Compare operators are typically == and/or === and some languages uses their own like ‘eq’ or other exciting ways.
Languages and compilers works in different ways, but your program could look like this. (When comparing a Boolean you don’t need the operator, you can just write the variable since it’s either true or false)
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !programmerhumor@lemmy.ml
Post funny things about programming here! (Or just rant about your favourite programming language.)
Rules:
Posts must be relevant to programming, programmers, or computer science.
No NSFW content.
Jokes must be in good taste. No hate speech, bigotry, etc.
if CanReadThis = true { TooClose = true }
Feel free to make it look like proper code lol, I don’t know how to program :P
Decided to write it in python for brevity.
though if you know what you’re doing, you’d be more likely to do something like
Ty ty.
Most programming languages uses = to copy a value into whatever whatever you put on the left side. You did it with TooClose, which you set to true.
But when you compare values as you do with the if statement, you need another operator, otherwise CanReadThis will be set to true and the if statement will always run (or syntax error), making it unnecessary.
Compare operators are typically == and/or === and some languages uses their own like ‘eq’ or other exciting ways.
Languages and compilers works in different ways, but your program could look like this. (When comparing a Boolean you don’t need the operator, you can just write the variable since it’s either true or false)
If (CanReadThis) { TooClose = true; }
Lol ty for the help!