Code: Select all
x=3 ! prt(f(x))
end
def prt(x) ! print x ! end def
def f(x)
return 4*x-3
end def
Code: Select all
x=3 ! prt(f(x))
end
def prt(x) ! print x ! end def
def f(x)
return 4*x-3
end def
Code: Select all
' Enumeration for selected color mode:
(I usually put all enumerations for a program in one library file)
COLOR_MODE_RGB = 1
COLOR_MODE_HSL = 2
' . . .
' Then everywhere else in the program, I can refer to these with the variable names instead of memorizing that RGB is 1 and HSL is 2
SWITCH_TO_COLOR_MODE(COLOR_MODE_RGB)
' . . .
DEF SWITCH_TO_COLOR_MODE(cm)
IF cm = COLOR_MODE_RGB THEN
' ...
ELSE ' cm = COLOR_MODE_HSL
' ...
END IF
END DEF
Yes, Matt is right of course. The "def prt(x)" clearly indicates that a value is expected.Henko wrote: ↑Fri Mar 01, 2019 3:36 pmIt is not mentioned explicitly in the sB help info, but a function name may be passed to another function in the parameter list.
Code: Select all
x=3 ! prt(f(x)) end def prt(x) ! print x ! end def def f(x) return 4*x-3 end def