-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfilename.jag
45 lines (45 loc) · 1.48 KB
/
filename.jag
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
set greeting to "Hello, world!"
speak greeting
set intro to "My name is Jag, the simple and easy-to-understand programming language!"
speak intro
set incomplete to 1
while incomplete equals 1
speak "I have if statements and can take input!"
speak "Note: if you want to input a string, you need to put quotation marks (") around it. Otherwise I'll think it's a variable name or a number!"
set var1 to record "Say something: "
set var2 to record "Say something else: "
speak var1
speak var2
if var1 equals var2
speak "You typed the same thing twice!"
end if
if var1 does not equal var2
speak "Those answers were different!"
end if
speak "I can set variables, do while loops, and compute as well!"
set var3 to 0
while var3 is less than 10
speak "In a loop now!"
set var3 to var3 + 1
speak var3
end loop
speak "And of course, I can speak! I'm doing that right now!"
speak "I have some less useful features as well, like sleeping and clearing the screen."
sleep 2
clear
$ Look at me! I'm a comment! WHEE!
speak "I've got some conversions too! I can change things from lowercase to uppercase, for example."
set lower to record "Say something lowercase! "
set lower to lower uppercase
speak lower
speak "Finally, I can pause. Going to do that now."
pause
set repeat to record "Thanks for reading! Do you want to read it again? ["y"/"n"] "
if repeat equals "y"
set incomplete to 1
end if
if repeat equals "n"
set incomplete to 0
end if
end loop
speak "Have fun coding in Jag!"