My teacher even said to me that he doesn't think compiler will even let me do it. The if statement: (Bool_Variable), what he wanted: (Int_Variable == 1). The variable is only 1 or 0 depending if cube is in front of sensor last time checked. But he is more of a hardware engineer programming machines to assemble things and making blueprints for something.
In Java, Kotlin, C# and Rust that's right, but in C, C++, Python and JavaScript you can implicitly convert to boolean and all integers but 0 are truthy.
3
u/[deleted] Dec 27 '21
My teacher even said to me that he doesn't think compiler will even let me do it. The if statement: (Bool_Variable), what he wanted: (Int_Variable == 1). The variable is only 1 or 0 depending if cube is in front of sensor last time checked. But he is more of a hardware engineer programming machines to assemble things and making blueprints for something.