SPOJE.NET

Technická dokumentace

Uživatelské nástroje

Nástroje pro tento web


howto:misc:czu:smalltalk

Smalltalk / Daskalos

"Note that variables begining with uppercase letter will be moved into the workspace pool."
 
o1 := Osoba new.
o1 jmeno: 'Karel'; prijmeni: 'Vcelka'; datumNarozeni: '3 3 2010' asDate.
 
f1 := Firma new.
f1 jmeno: 'NecoStav'; ico: 4564546.
 
a1:=Auto new.
a1 znacka: 'BMW'.
a1 model: 'M3'; rokVyroby: 2000; vlastnik: o1.
 
n1:= Nakladak new.
n1 znacka: 'Tatra'; rokVyroby: 1995; vlastnik: f1.
 
Auta := Set new.
Auta add: a1; add: n1.
 
Osoby := Set new.
Osoby add: o1.
Auta select: [:s | s rokVyroby > 1998 ]
Auta select: [:s | s vlastnik jmeno = 'Karel']
vek
	"ziskej vek"
 
	^ Date today year - datumNarozeni year

Ucty select: [:a | a mena = 'EUR']
Ucty select: [:a | a majitel jmeno = 'Pavel']
Ucty select: [:a | a mena = 'EUR' & a majitel jmeno = 'Karel']
(Ucty select: [:a | a mena = 'EUR']) select: [:b | b majitel jmeno = 'Karel']
((Ucty select: [:a | a mena = 'EUR']) select: [:b | b majitel jmeno = 'Karel']) collect: [:c | c majitel bydliste]
(((Ucty select: [:a | a mena = 'EUR']) select: [:b | b majitel jmeno = 'Karel']) collect: [:c | c majitel bydliste]) project: #mesto
Ucty collect: [:u | u majitel]
Klienti project: #jmeno with: #prijmeni
howto/misc/czu/smalltalk.txt · Poslední úprava: 2016/03/14 22:26 autor: 127.0.0.1