by Brent B. Welch About the author: Brent Welch �ثe���������إߤ@�� www.scriptics.com ����, �]�A�@�Ӧ���Tcl���� �� URLs ( Tcl�귽����) �å[�W���Ѫ���Ʈw�M�@��TclPro Product���q�l�Ӱȫس] (ecommerce infrastructure) �C�L�]�b�}�o�X�Ӥj���� Tcl/Tk���ε{��,�]�A���b www.scriptics.com �����W���檺Tcl Httpd web ���A���BExmh �l��ϥΪ̤����M webtk HTML �s�边�C�L�O " Tcl �M Tk �{���]�p��� (Practical Programming in Tcl and Tk)" �@�Ѫ��@�̡CWelch ��1982�~�b��ù�Ԧh�{Boulder�j�ǯ�Ťu�{�t��o �Ǥh�Ǧ�, 1986�~�b�[�{Berkeley�j�Ǩ��o��T�u�{�Ӥh�Ǧ�, 1990�~�b�[�{Berkeley �j�Ǩ��o��T�u�{�դh�Ǧ�CWelch���e�O Xerox���q PARC��s���߬�s�����@����, ��s�������t�� (distributed systems)�C�M��L�[�J Sun Microsystems ����Ǥ� Tcl/Tk�p�զ����C�L�]�O����q����|(ACM)�M��ڹq�l�u�{�v��| (IEEE) ���|���C ������}�Ghttp://www.beedub.com/ Content: |
Abstract:
�o�g�峹���ФFTcl�y�������[���M�y�k�C
�H�@�ظ}���y���ӻ�, Tcl�㦳²�檺�y�k�C
cmd arg arg arg
$foo
foo
.
[clock seconds]
"some stuff"
{some stuff}
\
�U���O�@��Tcl �R�O�ΨӦC�X�ثe�ɶ��C���ϥΤF�T��Tcl�R�O : set
, clock
,�M puts
. set
�R�O�N�ȳ]�w���ܼơCclock
�R�O�B�z�ɶ��ܼơC puts
�R�O�C�X���G�C
set seconds [clock seconds] puts "The time is [clock format $seconds]"
�`�N�@�U�b�]�w�ȵ��ܼƮɨå��ϥ� $ �Ÿ��C�u���b�ϥ��ܼƮɤ~�ϥ� $ �Ÿ��C�b�W�ӨҤl��
seconds
�ܼƨä��O�������C�A�i�ϥΤ@�өR�O�ӦC�L�X�ثe���ɶ�:
puts "The time is [clock format [clock seconds]]"
�Q��Tcl parser ��RTcl�y�k�����ϥΥH�U�T�ӨB�J: �N�ѼƤ����s��, ���G���N�M�R�O����
puts
�R�O���@�ӰѼơC
$foo
���ȴ��N�F foo
, �ε��G���N�F�A���R�O�C���N�O�b���դ���i�檺�C�o�ئ��ǨϯS�O���Ȩå��ϩR�O���c�ܽ���.
�U���O�t�@�ӨҤl:
�b���B, �j�A���ΨӱN�ѼƤ���, �B�èS����������N�C Tcl parser �F��set i 0 while {$i < 10} { puts "$i squared = [expr $i*$i]" incr i }
while
�R�O�èS���S�O���a��, �N����ݨ䥦���@��R�O�@�ˡC while
�R�O�Q�� Tcl Parser ����, �i���D�Ĥ@�ӰѼƬO�B�⦡, �ӲĤG�ӰѼƫh�O�h�� Tcl �R�O�C �j�A���N��������ӰѼ�:��B�⦡�P����j��, Tcl �R�O�b�j�鳡���C
�ڭ̬ݨ�F��ӼƾǹB�⦡: ���L�N�Ƥ���M���k�B��Cwhile �R�O�۰ʱN�@�ӰѼƭȷ��@�B�⦡�ӭp��C�b��L�����p�U, �z�n���T�ϥ�
expr
�R�O�Ӱ���ƾǹB��
�̫�, Tcl �I�s�䥦�{�ǨӳB�z�x�����u�@�C�ڭ̤w�g�i�ݨ� Tcl �ϥ� expr
�R�O�Ӱ���ƾǨ��, puts
�R�O�ӳB�z��X�\��, set
�R�O�ӳ]�w�ȵ��ܼơC�o�� Tcl �R�O�O�z�L�����w�b Tcl ���n���L (Registered) �� C �y���{�ǨӰ��檺�CC �y�����R�O�{�ǥ� Tcl �R�O���o�r��Ѽ�, �M��Ǧ^�@�ӵ��G���@�ӷs���r��C�Q�n���g C �y���R�O�{�ǫ�²��C���i�H������Ʊ�, �]�A�s����Ʈw�M�إ߹ϧΨϥΪ̤����CTcl�y��, �ä����D�R�O�|������˪��\�� , ���u�O�Q�ΰѼƤ��s��, ���G���N�M�R�O�����T�B�J�Ӱ���R�O�C
�o�̬O�@�Ӷ����{��:
proc fac {x} { if {$x < 0} { error "Invalid argument $x: must be a positive integer" } elseif {$x <= 1} { return 1 } else { return [expr $x * [fac [expr $x-1]]] } }
Webpages maintained by the LinuxFocus Editor team
© Brent B. Welch LinuxFocus 1999 |
Translation information:
|
1999-10-28, generated by lfparser version 0.8