# The variable that contains an entire number in the end,

Posted 9 years ago
3790 Views
|
2 Replies
|
1 Total Likes
|
 If I have the following variables:  gpo={}; oee={{{0, 50}, {120, 100}}, 2}; If[ gpo= ={} && Last[oee] ==(* any integer *) , (* then that returns me the variable that contains an entire number in the end, in this case oee *) ] I have tried using Cases without success, any idea is useful and welcome,I would like to ask if I can clear some threads that I've started ?
2 Replies
Sort By:
Posted 9 years ago
 Bruce - I'm not entirely certain, but I think an "entire number" is an integer.Luis - I don't quite understand what exactly you want your code to return; do you want the name of the variable? Are there more variables than just "oee", and you need to find the one that ends with that specific integer? I don't think you can easily access the name of a variable once it's been assigned a value, so you might have to write this differently.Does something like this help you at all? gpo = {}; foo["a"] = {{{0, 50}, {120, 100}}, 2}; foo["b"] = {{{10, 30}, {110, 90}}, 4}; foo["c"] = {{{20, 40}, {80, 30}}, 7}; foo["d"] = {{{20, 50}, {70, 30}}, 2}; names = {"a", "b", "c", "d"}; DeleteCases[If[gpo == {} && Last[foo[#]] == 2, #] & /@ names, Null] (*the ouput of this is: {"a", "d"}*) 
Posted 9 years ago
 a) What is an "entire number"? b) If there are posts of yours you would like deleted, email wolfram-community@wolfram.com and describe which new thread or reply you want deleted. The URL (example: http://community.wolfram.com/groups/-/m/t/326537) is helpful.