func init // adds using namespace sys.add_use('System.Numerics') // initialize instance if(linked("Result") and linked("doFromPolarCoordinates")) sys.add_var(this.name, 'Complex') end end func doFromPolarCoordinates(data) if(linked('Result')) blk.println(this.codename, ' = ', this.make_result(data), ';') event('onResult', this.codename) else event('onResult', this.make_result(data)) end end func make_result(data) return('Complex.FromPolarCoordinates(' + d("Magnitude") + ', ' + d("Phase") + (isdef("PhaseUnit") ? '' : ' * (Math.PI/180)') + ')') end func Result if(linked("doFromPolarCoordinates")) return(this.codename) else return(make_result()) end end