As in Algol, the programs are pretty-printed in different fonts, as in ABC 80 BASIC, the pretty-printing is enforced, as in COBOL, the programs pretend to be in English, as in Fortran, you have to use continuation characters, as in C++, the error messages are incomprehensible: AppleScript.
Here is our old friend, the Hailstone program:
on run
display dialog "Seed" default answer "" buttons {"OK"} default button "OK"
set a to (text returned of result) as integer
set outstring to a as string
repeat until a is equal to 1
if a mod 2 is equal to 0 then
set a to a div 2
else
set a to a * 3 + 1
end if
set outstring to outstring & ", " & a as string
end repeat
display dialog outstring buttons {"OK"} default button "OK"
end run
2011-05-06
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment