A-man Posted August 28, 2012 Share Posted August 28, 2012 I have the code var x: integer; Const W = 512; begin x := W/16; writeln(x); end; the line with x := W/16 throws a type mismatch. I think it has to do with the division, but I'm pretty sure it didnt used to do that before. I also tried using x := int(W/16); and that didn't work either. There is more to my code, this is just the essentials of the scenario. I should note that if I replace the W/16 with 32, the code executes perfectly. Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted August 28, 2012 Share Posted August 28, 2012 It should throw an error regardless of the number you use. The integer division symbol is div. SCAR is very strict about the syntax rules. Takes a bit of getting used to. [sCAR] x := W div 16;[/sCAR] Quote Link to comment Share on other sites More sharing options...
LordJashin Posted August 28, 2012 Share Posted August 28, 2012 In math integers are defined as being natural numbers, 0, and negative numbers. Not fractions! I'm no math genius but that is what an integer is (google it). So thus you can't divide the Integer 2 / 3, because that would end up being a fraction. But if you had 2 as a type called Extended which can be a fraction. Then you could do it. DIV is used to divide the number evenly, and I think it rounds either up or down. Quote Link to comment Share on other sites More sharing options...
shadowrecon Posted August 28, 2012 Share Posted August 28, 2012 [scar] var x: Extended; Const W = 512.0; begin x := W / 16; writeln(x); end. [/scar] Successfully compiled (33.3857 ms) 32 Successfully executed (11.0153 ms) Quote Link to comment Share on other sites More sharing options...
A-man Posted August 29, 2012 Author Share Posted August 29, 2012 Ahh thanks, that makes sense Quote Link to comment Share on other sites More sharing options...