HyperTalk


on OpenStack
  show message box
  put "Hello World!" into message box
end OpenStack


submitted by: allanc@crl.com (Allan 'Norm' Crain)

HyperTalk again...but better!


I'm the author of HyperTalk and I'd like to improve your hello world example.  
The example you have now is:

on OpenStack
  show message box
  put "Hello World!" into message box
end OpenStack

But since the message box is shown when needed automatically, and is also the 
default destination of a put command, you could get exactly the same result from 
this shorter script:

on openStack
  put "Hello World!"
end openStack

Also, since commands can be typed directly into HyperCard's message box, you 
could really just type:

put "Hello World!"

without making an openStack handler at all.

Also, if you wanted to have the message come up in a new dialog box you could do:

answer "Hello World!"

Finally, if you wanted it to repeat forever as some of the examples from other 
languages do, you could use a repeat statement.  The message box won't take multiple 
line statements so this would require making a handler, but you wouldn't normally use 
openStack.  I think a better choice would be to make up a new message, say "hello":

on hello
  repeat forever
    answer "Hello World!"
  end repeat
end hello

This little handler will begin running when you enter the message "hello" and will 
repeated put up a dialog box that says hello world and let's you click OK.  It will not 
stop until you hit command-. on the Mac.

--Dan Winkler


submitted by: heydan@tiac.net (Dan Winkler)