 *** Welcome to SAD Ver.1.4.4.2k64 built at 2026-10-19 14:46:59 +0900 ***
 *** Today: 00:35:56 Tuesday 11/17/2026 ***
 OFF LOG;ON ECHO;READ 77 ;           1
FFS;
 *** SADScript Initialization: /mnt/d/work/SAD-master/SAD-master/Packages/init.n ***
 *** Run time Environment:     /mnt/d/work/SAD-master/SAD-master/Packages/init.local.n ***
 RFSW RADCOD RAD  FLUC  INTRA POL   COD  DAPER EMIOU K64   FOURI SMEAR
   F     F     F     T     F     F     T     F     F     T     F     T
 x = 10;
 (* Module: 字句的な局所変数。呼び出しごとに新しい変数 *)
 m1[] := Module[{x = 1, y}, y = x + 1; x = x + 100; {x, y}];
 Print["Module ", m1[], " global x=", x];
Module {101,2} global x=10
 (* Block: 動的スコープ。値だけを一時的に差し替える *)
 show[] := x;
 b1[] := Block[{x = 7}, show[]];
 m2[] := Module[{x = 7}, show[]];
 Print["Block  ", b1[], "  Module ", m2[], "  global ", show[]];
Block  7  Module 10  global 10
 (* With: 定数の置換 (局所変数は書き換えられない) *)
 Print["With ", With[{a = 3, b = 4}, Sqrt[a^2 + b^2]]];
With 5
 (* 入れ子と初期化 *)
 n1[] := Module[{a = 1}, Module[{a = 2}, a] + a];
 Print["nested Module ", n1[]];
nested Module 3
 (* Module が返す局所記号 *)
 c[] := Module[{t}, t];
 Print["Module symbol is not t: ", c[] === t];
Module symbol is not t: 0
 (* 局所変数が同じ名前の別関数を呼ぶ間も独立 *)
 cnt[] := Module[{n = 0}, Do[n++, {5}]; n];
 Print["cnt ", cnt[], cnt[]];
cnt 55
 (* 反復の中の Module *)
 Print[Table[Module[{s = 0}, Do[s += j, {j, i}]; s], {i, 5}]];
{1,3,6,10,15}
 Exit;
Out[1]:= Exit
 FFS                  end:  CPU time =     0.000 sec
 Design orbit length =   1.0000000000000000     
 RFSW RADCOD RAD  FLUC  INTRA POL   COD  DAPER EMIOU K64   FOURI SMEAR
   T     F     F     T     F     F     T     F     F     T     F     T
 In[2]:=  ???-getbuf-end of input stream
