Getting started with Tcl: example 4

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

Using Tcl functions

Script

#!/usr/bin/tclsh
# Using Tcl functions.
 
set Number 5
set MyString "I love Paris"
 
set l [string length $MyString]
puts stdout "MyString length is $l"
 
set pi [expr 2 * asin(1.0)]
puts stdout "pi ~= $pi"
 
set x 5
set y 6
puts stdout "$x + $y = [expr $x + $y]"

# { vs. "
puts stdout {$x + $y = [expr $x + $y]}

Output

MyString length is 12
pi ~= 3.14159265359
5 + 6 = 11
$x + $y = [expr $x + $y]

<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-04.txt · Last modified: 2017/04/05 16:03 (external edit)
 
 
Driven by DokuWiki