record method 2



record_method2
Smart pascal source code
Type TRec = Record Field: String; Function GetName: String; Begin Result := 'Hello ' + Field; End; procedure SetExclamation; begin Field := Field + '!'; end; End; Function GetRec: TRec; Begin Result.Field := 'World'; End; WriteLn(GetRec.GetName); var r := GetRec; r.SetExclamation; WriteLn(r.GetName); {<<< RESULT - CONSOLE LOG >>> ----------------------------- Hello World Hello World! ----------------------------- {<<<<<<<<< THE END >>>>>>>>>}