Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
SNOBOL
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Example programs == The "Hello, World!" program might be as follows... <syntaxhighlight lang=snobol> OUTPUT = "Hello, World!" END </syntaxhighlight> A simple program to ask for a user's name and then use it in an output sentence... <syntaxhighlight lang=snobol> OUTPUT = "What is your name?" Username = INPUT OUTPUT = "Thank you, " Username END </syntaxhighlight> Use :S (branch on successful match) to choose among three possible outputs... <syntaxhighlight lang=snobol> OUTPUT = "What is your name?" Username = INPUT Username "J" :S(LOVE) Username "K" :S(HATE) MEH OUTPUT = "Hi, " Username :(END) LOVE OUTPUT = "How nice to meet you, " Username :(END) HATE OUTPUT = "Oh. It's you, " Username END </syntaxhighlight> To continue requesting input until no more is forthcoming... <syntaxhighlight lang=snobol> OUTPUT = "This program will ask you for personal names" OUTPUT = "until you press return without giving it one" NameCount = 0 :(GETINPUT) AGAIN NameCount = NameCount + 1 OUTPUT = "Name " NameCount ": " PersonalName GETINPUT OUTPUT = "Please give me name " NameCount + 1 PersonalName = INPUT PersonalName LEN(1) :S(AGAIN) OUTPUT = "Finished. " NameCount " names requested." END </syntaxhighlight>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)