This is very junior, but how does one express a “but” as a conditional statement? The language really doesn’t matter. I was trying to wrap my brain around how it’s interpreted in code and couldn’t seem to find any information when researching.
for example in pseudo-code
I like Apples, but I like Washington apples more
I think the literal translation of a
butinto a programming language might be hard, but (/chuckle) you can look at specific instances and find a way to translate them.For example (using a previous poster’s pees example)
You can somewhat read this as
Given that interpretation, you can treat it as a special case and code it like
You can almost think of it like a guard or edge case condition. For example, when reading a file (using REALLY bad code to illustrate the idea):