Action disabled: export_raw

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 = $

<html><br/></html>


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: by 127.0.0.1
 
 
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0