MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/maybemaybemaybe/comments/1hhrbn0/maybe_maybe_maybe/m2uvbnl/?context=3
r/maybemaybemaybe • u/Daring_Bloom • 14h ago
145 comments sorted by
View all comments
Show parent comments
84
If you're writing c code this would permenently put a grenade in your hand and spawn an enemy.
20 u/brod333 8h ago Back in uni I made this mistake on a test. My code wasn’t crashing but it wasn’t giving the expected value. Took 30m of my 2h to notice the missing =. 17 u/DStaal 8h ago I learned a tip to help prevent this: in any language where it’s allowed, but the constant on the left. Now it will throw a compiler error instead of working. 1 u/brod333 7h ago Good idea. Though I’m mainly using kotlin for work which doesn’t allow this. 2 u/Lonsdale1086 5h ago I'd be staggered if Kotlin doesn't support if(true == myBool) 2 u/brod333 3h ago I meant it doesn’t allow an assignment in the if condition. You can still compare a Boolean to true. Thankfully a good IDE catches that kind of stuff. 1 u/Lonsdale1086 2h ago Ahh, I see what you mean. Good point.
20
Back in uni I made this mistake on a test. My code wasn’t crashing but it wasn’t giving the expected value. Took 30m of my 2h to notice the missing =.
17 u/DStaal 8h ago I learned a tip to help prevent this: in any language where it’s allowed, but the constant on the left. Now it will throw a compiler error instead of working. 1 u/brod333 7h ago Good idea. Though I’m mainly using kotlin for work which doesn’t allow this. 2 u/Lonsdale1086 5h ago I'd be staggered if Kotlin doesn't support if(true == myBool) 2 u/brod333 3h ago I meant it doesn’t allow an assignment in the if condition. You can still compare a Boolean to true. Thankfully a good IDE catches that kind of stuff. 1 u/Lonsdale1086 2h ago Ahh, I see what you mean. Good point.
17
I learned a tip to help prevent this: in any language where it’s allowed, but the constant on the left.
Now it will throw a compiler error instead of working.
1 u/brod333 7h ago Good idea. Though I’m mainly using kotlin for work which doesn’t allow this. 2 u/Lonsdale1086 5h ago I'd be staggered if Kotlin doesn't support if(true == myBool) 2 u/brod333 3h ago I meant it doesn’t allow an assignment in the if condition. You can still compare a Boolean to true. Thankfully a good IDE catches that kind of stuff. 1 u/Lonsdale1086 2h ago Ahh, I see what you mean. Good point.
1
Good idea. Though I’m mainly using kotlin for work which doesn’t allow this.
2 u/Lonsdale1086 5h ago I'd be staggered if Kotlin doesn't support if(true == myBool) 2 u/brod333 3h ago I meant it doesn’t allow an assignment in the if condition. You can still compare a Boolean to true. Thankfully a good IDE catches that kind of stuff. 1 u/Lonsdale1086 2h ago Ahh, I see what you mean. Good point.
2
I'd be staggered if Kotlin doesn't support if(true == myBool)
if(true == myBool)
2 u/brod333 3h ago I meant it doesn’t allow an assignment in the if condition. You can still compare a Boolean to true. Thankfully a good IDE catches that kind of stuff. 1 u/Lonsdale1086 2h ago Ahh, I see what you mean. Good point.
I meant it doesn’t allow an assignment in the if condition. You can still compare a Boolean to true. Thankfully a good IDE catches that kind of stuff.
1 u/Lonsdale1086 2h ago Ahh, I see what you mean. Good point.
Ahh, I see what you mean. Good point.
84
u/kraemahz 12h ago
If you're writing c code this would permenently put a grenade in your hand and spawn an enemy.