SNOBOL: 두 판 사이의 차이

내용 삭제됨 내용 추가됨
Metrobot (토론 | 기여)
잔글 ISBN 매직 링크 제거
잔글 →‎프로그램의 예: unindenting
16번째 줄:
 
<syntaxhighlight lang=snobol>
OUTPUT = "Hello world"
END
</syntaxhighlight>
 
사용자 이름을 물어본 다음 출력 문장에 사용하는 단순한 프로그램은 다음과 같다.
<syntaxhighlight lang=snobol>
OUTPUT = "What is your name?"
Username = INPUT
OUTPUT = "Thank you, " Username
END
</syntaxhighlight>
 
31번째 줄:
 
<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>
 
44번째 줄:
 
<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>