View Single Post
  #3  
Old 01-21-2008, 03:13 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
One thing I like about GS2 that Java doesn't have (but I would not want Java to have; would makes things incredibly complicated.

You can do something like this in GS2:
PHP Code:
function onFoo()
{
  if ( 
isFooing )
  {
    return;
  }
  echo( 
"No, you are not fooing ..." );

Whereas in Java you would need to do something like this to get out of a function easily:

PHP Code:
public boolean onFoo()
{
  if ( 
isFooing )
  {
    return 
false;
  }
  
System.err.println"You are not fooing ..." );
  return 
false;

Makes it much easier to leave functions when you don't need to specify everything.

Also, when comparing strings you CAN use ==.

PHP Code:
if ( foo == no )
{
  echo( 
"not foo" );

vs.

PHP Code:
if ( foo.equalsno ) )
{
  
System.err.println"not foo" );

Also, I find it nice that you can handle conversions much easier- the system does it for you! What I mean is that an int is a double is a float, etc, where in Java you need to do conversions int.readDouble() ...

Just a few things that are different in Java vs GS2
__________________
Reply With Quote