Input
Press [Ctrl]+[/]
Press [Ctrl]+[^]
Press [Ctrl]+[@]
Define a function
Input:
f[x_] := x^2 + x + 1
f[1]
Output:
3
What difference between f[x_]:= and f[x_]= ?
:= means delayed assignment, the value will recompute everytime it needed.
= means assign value immediately
** =. means clear assignment
What difference between f[x_] and f[x] ?
input:
f[x_] := x^2 + x + 1
f[1]
g[y] := x^2 + x + 1
g[1]
output:
3
g[1]
No comments:
Post a Comment