shijiang1130 发表于 2014-12-26 23:06

用变量做函数名

-module(t).
-compile(export_all).

test(Whatever)->
        ?MODULE:Whatever().

changeme()->
        io:format("Look at here").

mybad()->
        io:format("mybad").

shijiang1130 发表于 2014-12-26 23:07

1> c(t).
{ok,t}
2> t:
changeme/0   module_info/0module_info/1mybad/0      test/1         

2> t:test(changeme).
Look at hereok
3> t:test(mybad).   
mybadok
4>
页: [1]
查看完整版本: 用变量做函数名