# How to make a function take another function as an input?

I am quite new to mathematica, and I simply want to know how to make a custom function, take another arbitrary function as an input.

I have attached code that shows what I am trying to accomplish (with output in the form of a list of lists). The last line of code is trying to be descriptive with reagrds to the roles that the different inputs should play, however it is only the "somefunction" part with its "variable" that I am mainly interested in knowing how it works.

Best regards.

sildeben[Sin[x], {x, 0, Pi, 2}]

Output:{{0., 0.}, {1.5708, 1.}, {3.14159, 0.}}

f[x_] := 3 x^3 - 6 x

sildeben[f[t], {t, -3, 3, 10}]

Output:{{-3., -63.}, {-2.4, -27.072}, {-1.8, -6.696}, {-1.2, 2.016}, {-0.6, 2.952}, {0., 0.}, {0.6, -2.952}, {1.2, -2.016}, {1.8, 6.696}, {2.4, 27.072}, {3., 63.}}

sildeben[somefunction_, {variable_, startvalue_, endvalue_, steps_}]

sildeben[expr_,{variable_,startvalue_,endvalue_,steps_}] := Table[
{variable,expr},{variable,Subdivide[startvalue,endvalue,steps]}];

{#, Sin[#]} & /@ Subdivide[0, π, 2] // N


{{0., 0.}, {1.5708, 1.}, {3.14159, 0.}}

f[x_] := 3 x^3 - 6 x

{#, f[#]} & /@ Subdivide[-3, 3, 10] // N


{{-3., -63.}, {-2.4, -27.072}, {-1.8, -6.696}, {-1.2, 2.016}, {-0.6, 2.952}, {0., 0.}, {0.6, -2.952}, {1.2, -2.016}, {1.8, 6.696}, {2.4, 27.072}, {3., 63.}}

Syed's answer is fine. I am suggesting another for completeness

funct[steps_] := N@Table[{a Pi, Sin[a Pi]}, {a, 0, steps, 1/2}]


when you run

funct[1]


you get

{{0., 0.}, {1.5708, 1.}, {3.14159, 0.}}

and for the second

funct[steps_] := N@Table[{x, 3 x^3 - 6 x}, {x, -3, 3, steps}]


then

funct[0.6]


gives

{{-3., -63.}, {-2.4, -27.072}, {-1.8, -6.696}, {-1.2, 2.016}, {-0.6, 2.952}, {0., 0.}, {0.6, -2.952}, {1.2, -2.016}, {1.8, 6.696}, {2.4, 27.072}, {3., 63.}}