Académique Documents
Professionnel Documents
Culture Documents
#this is a comment; puts hi (when interpreter sees first # it makes all line as
comment hence ignores)
set a 100;
set A 10; has no problem
set B; has problem as the variable is not initialized hence cant read B so error
set a 20;
puts [set a]; #reading
incr
puts $a
incr a ( incr commands takes everything as integer and increments by 1 in defaul
t)
incr variable name ?incrementValue?
incrementValue - optional
default value = +1
it can take any positive and negative integer not zero
set a 10
set b 20
set c a+b; #prints 10+20 not 30
puts $a
puts hi
standard input/output devices:
stdout - monitor
stderr - monitor
std in - keyboard
puts hi
puts stdout hi (explicitly saying to print on monitor)
puts stderr hi (explicitely saying to print on monitor)
set company Wipro
append company Technologies
puts $company
it prints WiproTechnologies
append company Wipro
append company Technologies
puts $company
it also prints WiproTechnogies (as append also creates a variable)
set company Wipro
append company " "
append company Technologies
puts $company
output: Wipro Technologies
set company Wipro
append company " ""
syntax of append command:
append varName value1 ? value2 value3 .............. value n?
append company " Technologies Bangalore Karnataka
puts { the value of this computer is \t: $5000} it will not put tab as it can no
t substi