REM See the WYWTK Index of BBC BASIC Tutorials for more help with BBC BASIC. Many pages give you more than just the code, the way this one does.
REM wywtk.com/prgm/bas/basb-def-fn-w-param.htm
REM DefFnWParam.bbc- Demo of DEF FN
REM vers 20 Mar 25
REM started 20 Mar 25

REM Exercise for the learner... add a tiny bit which
REM  just "cuts out" the last "That would be..."
REM  which currently happens when user enters 999

PRINT "Hello. This will convert weights in lbs to weights in kg"
REPEAT
  INPUT "Weight in pounds> (Enter 999 to finish)" lbs%
  PRINT "That would be ";FN_lbs_to_kgs(lbs%);" kgs"
UNTIL lbs%=999
PRINT
PRINT"Goodbye"
WAIT 200
QUIT
END

DEF FN_lbs_to_kgs(to_convert%)
=to_convert%*2.2