; Int Example ; ----------- ; Int converts a value to the NEAREST integer - the same conversion ; Blitz applies when you assign a float to an integer variable. ; Compare Ceil (always rounds up) and Floor (always rounds down). Print " value Ceil Floor Int" Print "------------------------------------" ; Each Read pulls the next sample value from the Data line below For i=1 To 6 Read v# Print RSet(v,10)+RSet(Ceil(v),10)+RSet(Floor(v),10)+RSet(Int(v),6) Next Data 2.3,2.7,2.5,-2.3,-2.7,-2.5 Print "" ; Values exactly halfway round to the nearest EVEN integer Print "Int(2.5) = "+Int(2.5)+" Int(3.5) = "+Int(3.5)+" (halves go to the even neighbour)" Print "" ; Int also converts strings, reading as many digits as it can Print "Int of the string 10 = "+Int("10") Print "Int of the string 3.7 = "+Int("3.7")+" (stops at the decimal point)" Print "Int of the string junk3 = "+Int("junk3") Print "" Print "Press any key to close the example" WaitKey End