Hi,
I was wondering if it is possible to concatenate a string with an integer variable, and then execute it as the name of a function to call?
So if I had some code which simulated a dice and so there were six different methods names face1,face2... etc.
if I randomly chose a number from 1-6 and stored it in iRoll, can i then simply concatenate the literal string "face" with iRoll and then run it as the method to call?
Cheers,
1DMF
"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."
"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Google Rank Extractor -> Perl beta with FusionCharts
I was wondering if it is possible to concatenate a string with an integer variable, and then execute it as the name of a function to call?
So if I had some code which simulated a dice and so there were six different methods names face1,face2... etc.
if I randomly chose a number from 1-6 and stored it in iRoll, can i then simply concatenate the literal string "face" with iRoll and then run it as the method to call?
Cheers,
1DMF
"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."
"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Google Rank Extractor -> Perl beta with FusionCharts