Getting started with Tcl : example 1

This page is part of the Airplug documentation related to Tcl/Tk.
Back to the Tcl/Tk documentation page / Back to the Airplug documentation page

Hello World

A first script, with comments, printing and special characters. To run such a script on a UNIX computer, you can copy-paste it and add the execution right:

cat > example1.tcl
(paste with the mouse + Ctrl C)
chmod +x example1.tcl
./example1.tcl

Script

#!/usr/bin/tclsh

# this is a comment

# printing
puts stdout {Hello World}

# Carriage return
puts stdout "This is a long sentence, which is\
             cut in my script."

# Special characters
set dollar \$
puts stdout "dollar = $dollar"

Output

Hello World
This is a long sentence, which is cut in my script.
dollar = $

<br/>


This page is part of the Airplug documentation related to Tcl/Tk.
Back to the Tcl/Tk documentation page / Back to the Airplug documentation page

 
Back to top
en/doc/pub/tcltk/example-01.txt · Last modified: 2017/04/05 16:02 (external edit)
 
 
Driven by DokuWiki