Timeline for Plot with local variables in Module[]: module or no module?
Current License: CC BY-SA 4.0
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Apr 22 at 14:23 | comment | added | lericr | If I were forced to use Module in your example, I'd probably set a variable to the entire function rather than just to the body. I.e. Module[{z=Function[{x,y},x+y>0]},... RegionFunction->z...]. | |
| Apr 22 at 14:20 | comment | added | lericr | Fine, but your example showed a gratuitous use of Module. You used Module to introduce a local variable that you didn't need, and then you ran into a problem that was directly related to the fact that you introduced a gratuitous variable. | |
| Apr 22 at 10:55 | comment | added | feynman | I just wonder what to do when I prefer keeping variables as local ones in modules | |
| Apr 20 at 15:07 | comment | added | lericr | Okay, well then I'd need more context to help you. As it stands, your example shows pretty much exactly what NOT to do. And it doesn't really have anything to do with Module but with introducing gratuitous coupling. So, can you give a more realistic example? | |
| Apr 20 at 15:02 | comment | added | feynman | the purpose of my question is about strategies with module. So module is essential | |
| Apr 20 at 14:25 | history | answered | lericr | CC BY-SA 4.0 |