Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
4
Task/Compound-data-type/Tcl/compound-data-type-1.tcl
Normal file
4
Task/Compound-data-type/Tcl/compound-data-type-1.tcl
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
array set point {x 4 y 5}
|
||||
set point(y) 7
|
||||
puts "Point is {$point(x),$point(y)}"
|
||||
# => Point is {4,7}
|
||||
3
Task/Compound-data-type/Tcl/compound-data-type-2.tcl
Normal file
3
Task/Compound-data-type/Tcl/compound-data-type-2.tcl
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
set point [dict create x 4 y 5]
|
||||
dict set point y 7
|
||||
puts "Point is {[dict get $point x],[dict get $point y]}"
|
||||
10
Task/Compound-data-type/Tcl/compound-data-type-3.tcl
Normal file
10
Task/Compound-data-type/Tcl/compound-data-type-3.tcl
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
oo::class create Point {
|
||||
variable x y
|
||||
constructor {X Y} {set x $X;set y $Y}
|
||||
method x {args} {set x {*}$args}
|
||||
method y {args} {set y {*}$args}
|
||||
method show {} {return "{$x,$y}"}
|
||||
}
|
||||
Point create point 4 5
|
||||
point y 7
|
||||
puts "Point is [point show]"
|
||||
Loading…
Add table
Add a link
Reference in a new issue