I have two types of arapper for simple processing / returning of one-dimensional arrays, and I want to write a method for converting one to another (2d-float-Vector class for 2d-int-point class). Wrote a simple one, but it just throws some errors that I donβt understand.
unit UUtil; interface uses UVector2f, Types, SysUtils; type Vector2fArrayWrapper = array of Vector2f; PointArrayWrapper = array of TPoint; implementation function toPointArray(vw : Vector2fArrayWrapper) : PointArrayWrapper; var pw : PointArrayWrapper; i,x,y : Integer; begin setLength(pw, vw.length); for i := 0 to vw.high do begin x := round(vw[i].getX()); y := round(vw[i].getY()); vw[i] := TPoint(x,y); end; result := pw; end; end.
These are the errors I get:
[Error] UUtil.pas(20): Record, object or class type required [Error] UUtil.pas(21): Record, object or class type required [Error] UUtil.pas(25): ')' expected but ',' found [Error] UUtil.pas(27): Declaration expected but identifier 'result' found [Error] UUtil.pas(28): '.' expected but ';' found
source share