In Java
ArrayList<String> strings = new ArrayList<String>();
In Pharo
strings := OrderedCollection new.
new
is a message sent to a classIn Java
Thread regThread = new Thread(
new Runnable() {
@Override
public void run() {
this.doSomething();
}
});
regThread.start();
In Pharo
[ self doSomething ] fork
In Java 8
new Thread(() -> this.doSomething()).start();
In Pharo
[ self doSomething ] fork
5 factorial
Transcript cr
3 + 4
5 -> 10
Transcript show: 'hello world'
2 between: 0 and: 5
In Java
receiver.keyword1keyword2(arg1, arg2)
In Pharo
anObject keyword1: arg1 keyword2: arg2
In Java
postman.send(mail,recipient);
postman.send(mail,recipient);
postman . send ( mail , recipient );
postman.send(mail,recipient);
postman . send ( mail , recipient );
postman send mail recipient
postman.send(mail,recipient);
postman . send ( mail , recipient );
postman send mail recipient
postman send mail to recipient
postman.send(mail,recipient);
postman . send ( mail , recipient );
postman send mail recipient
postman send mail to recipient
postman send: mail to: recipient
In Java
postman.send(mail,recipient);
In Pharo
postman send: mail to: recipient
send:to:
postman
mail
and recipient
)if
, else
, for
, while
, do
, ... are language keywordsfullName isEmpty
ifTrue: [ 'FirstnameLastname' ]
ifFalse: [ fullName ]
4 timesRepeat: [ self doSomething ]
0 to: 100 do: [ :i | ... ]
0 to: 100 by: 3 do: [ :i | ... ]
aCollection do: [ :each | ... ]
/