New answers tagged

3 votes

Create a list of indexed variables and assign values in one line of code

Clear[F] MapThread[Set,{F /@ {1, 3, 6, 8}, {2, 4, 6, 0}}]; F /@ {1, 3, 6, 8} (* {2,4,6,0} *)
user1066's user avatar
  • 15.6k
3 votes

Create a list of indexed variables and assign values in one line of code

Just another way: ...
vindobona's user avatar
  • 1,691
8 votes

Create a list of indexed variables and assign values in one line of code

another method: F = AssociationThread[{1, 3, 6, 8} -> {2, 4, 6, 0}] F[1] 2
AsukaMinato's user avatar
  • 8,940

Top 50 recent answers are included