Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: Return of a function

From: sunandadh:aol at: 19-Apr-2002 4:24

> print heure; nothing is print.. heure has no value now.. why ???
I see two main problems: 1. You define transFo-time yet use transo-time (no F in name) 2. You use the hm variable. But that's local to the function. Try this: transfo-time: func [hm] [ hm: parse hm "." hm/1: to-integer hm/1 hm/2: to-integer hm/2 hm: to-time join hm/1 [":" hm/2] hm ] heure: "12.01" heure: transfo-time heure print heure ;; will print 12:01 Inevitably loads of people will rewrite your function in clever and elegant ways. Here's my one-liner version. This will also work for 12.01.02: transfo-time: func [hm] [ return to-time replace/all hm "." ":" ] (I know I don't need 'return, but I like to be explicit about these things) Sunanda.