func() {
	eval "echo \"\${val_${1}}\""
}

val_x=24
(func x)
echo Done