Timeline for Specifying optional arguments with variables
Current License: CC BY-SA 3.0
12 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 8, 2020 at 3:33 | comment | added | Mr.Wizard | Closely related, possible duplicate: (26354) | |
Aug 19, 2016 at 13:13 | answer | added | Alexey Popkov | timeline score: 3 | |
Aug 18, 2016 at 18:07 | answer | added | QuantumDot | timeline score: 6 | |
Aug 7, 2013 at 13:24 | history | edited | Mr.Wizard |
edited tags
|
|
Aug 7, 2013 at 9:39 | history | edited | Kuba | CC BY-SA 3.0 |
better title more easy to find
|
Jul 23, 2013 at 8:54 | comment | added | Mr.Wizard |
Related FYI: Default appears to allow variable values, but it does not. You may already know this, but it's tripped up quite a few users I believe. Also, I see that Simon (I miss his participation) posted effectively the same method that Leonid just showed in answer to that old question of mine.
|
|
Jul 23, 2013 at 2:35 | history | tweeted | twitter.com/#!/StackMma/status/359502013626716163 | ||
Jul 22, 2013 at 21:01 | vote | accept | bobthechemist | ||
Jul 22, 2013 at 20:57 | answer | added | Leonid Shifrin | timeline score: 13 | |
Jul 22, 2013 at 20:46 | comment | added | Leonid Shifrin |
All you have to do is to define your function before var has any value, or use Block , such as Block[{var}, f[a_:var]:={a}] . See also this answer and a discussion in comments below it.
|
|
Jul 22, 2013 at 20:44 | comment | added | Kuba |
It is not what you are asking for but it does the same thing: f[x_]:={x}; f[]:={a};
|
|
Jul 22, 2013 at 20:40 | history | asked | bobthechemist | CC BY-SA 3.0 |