0

下面是一个数学会话,我在其中运行一些包含BeginEnd全部作为块的代码,然后一次一行。第一个会话失败,第二个会话成功。为什么?如何将代码作为一个块运行?

我是数学n00b。

In[1]:=  Begin["fibo`"]
   f = Table[1,{46}]; count = 2;
 End[];
Set::write: Tag Times in Begin[fibo`] f is Protected.
Out[1]= None

In[2]:= ??fibo`f
Out[2]= Null

In[3]:= ??fibo`count
Out[3]= Null

In[4]:= Begin["fibo`"]
Out[4]= fibo`

In[5]:= f=Table[1,{46}]; count = 2;
Out[5]= None

In[6]:= End[];
Out[6]= None

In[7]:= ??fibo`f
fibo`f = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
Out[7]= Null

In[8]:= ??fibo`count
Out[8]= Null

(附注:count即使在第二个示例中,仍然没有定义。也许我需要每行一个定义才能工作?)

4

0 回答 0