Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!wuarchive!sdd.hp.com!elroy.jpl.nasa.gov!ames!eos!data.nas.nasa.gov!eagle!news From: togood@roger.lerc.nasa.gov (Chris Miller) Newsgroups: comp.lang.pascal Subject: Re: Help Me!!! What's wrong with this simple problem? Message-ID: <1990Nov28.164132.1576@eagle.lerc.nasa.gov> Date: 28 Nov 90 16:41:32 GMT References: <527@shum.UUCP> <19956@oolong.la.locus.com> <28893@shamash.cdc.com> Reply-To: togood@roger.UUCP (Chris Miller) Organization: NASA/Lewis Research Center, Cleveland Lines: 19 In article <28893@shamash.cdc.com> mpe@shamash.UUCP (Mike Ebsen) writes: >What's wrong with this problem in Turbo Pascal 5.0... > > Program test; > var > i : integer; > j : word; > begin > j:=3; > i:=j-10; > writeln(j,' ',i); > end. > >My compiler tells me that the assignment of -7 into i (an integer) >is an error. Because j is of type word, the compiler is attempting to evaluate j-10 as type word. You must force it to be an integer. One way is: i:=integer(j-10);