Erlang - is_atom



此方法用於確定一個術語是否確實是原子。

語法

is_atom(term)

引數

  • term − 這是需要評估是否為原子的項值。

返回值

如果項值為原子,則返回真,否則返回假。

例如

-module(helloworld). 
-export([start/0]). 

start() -> 
   io:fwrite(atom1), 
   io:fwrite("~n"), 
   io:fwrite("~p~n",[is_atom(atom1)]).

輸出

以上程式的輸出如下所示。

atom1
true
erlang_atoms.htm
廣告

© . All rights reserved.