[erlang-questions] module syntax help

KDr2 <>
Mon Apr 13 11:08:03 CEST 2009


It's parameterized module,To declare a parameterized module, simply specify
some variable names in the module declaration:

*-module(foo,[Bar, Baz]).*

That's it! You're done. You've created a parameterized module. You got a
func called 'new' , And you can now use Bar and Baz in the scope of any
functions defined in your module.

code:
-module(xx,[A,B]).
-compile(export_all).

test()->
    io:format("A=~w,B=~w~n",[A,B]).


result:

Eshell V5.6.5  (abort with ^G)
1> B=xx:new(abc,"hehe").
{xx,abc,"hehe"}
2> B:test().
A=abc,B=[104,101,104,101]
ok
3>

btw: 中文名?中国人?

2009/4/13 人间世 <>

> code get from openpoker:“-module(exch, [Cbk, Context, Modules]).”
> What’s it mean?Is it correct module syntax?thank!
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions
>



-- 
Best Regards,
   -- KDr2, at x-macro.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090413/758080a3/attachment.html>


More information about the erlang-questions mailing list