Skip to main content

assignment - Using Block with a list of variables


I have a list of variables


var={v1,v2};

which I want to protect/localize during a particular operation. I have decided that I want to use Block and if I write


Block[{v1,v2},Print[4]] 

everything is fine but what I really need is to somehow implement the functionality:



Block[vars,Print[4]] 

Is there any way to achieve this?




Comments