[ | smalltalk dot org ].
Community and industry meet inventing the future.
Some Basic F-Script Examples
posted by Peter William Lount
version 1, 20040920 12:30pm PDT

Get the names of the employees:
Smalltalk:
employees collect:[:anEmployee | anEmployee name]

F-Script:
employees name

Get the names of the employees whose age is greater than 30:
Smalltalk:
(employees select:[: anEmployee | anEmployee age > 30]) collect:[: anEmployee | anEmployee name]

F-Script:
employees name at: employees age > 30

Get a list of employees sorted according to their salary:
Smalltalk:
employees asSortedCollection:[:e1 :e2| e1 salary < e2 salary]

F-Script:
employees at: employees salary sort

Increase the salary of each employee by a specific amount:
Smalltalk:
employees with:amounts do:[:anEmployee :anAmount| anEmployee raiseSalary:anAmount]

F-Script:
employees raiseSalary:amounts



Copyright 2006 by Smalltalk.org™, All Rights Reserved.
Thursday
July 24 2008
Interoperate.org, the place to find out how to interoperate.
Google
Web
Smalltalk.org

64bits.net AMD64, Intel Pentium EM64T, Intel Itanium
Meet other Smalltalk people, contribute, learn, earn.
lingoize.me
On speaking languages
naturally with ease
aiming for fluid fluency.