Group Abstract Group Abstract

Message Boards Message Boards

What's the difference between f[x_]= ... and f[x_]:=...

Posted 11 years ago

thanks

POSTED BY: erivaldo nunes
2 Replies
POSTED BY: Sean Clarke

yes there is, the := notation reevaluates the right-hand-side each time it is evaluated. So there is a difference between these two definitions:

ClearAll[p,f]
p=2;
f[x_]:=x+p;
p=3;
f[2]


ClearAll[p,f]
p=2;
f[x_]=x+p;
p=3;
f[2]
POSTED BY: Sander Huisman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard