digital literacy for everyone



[lit] although quasi was designed to teach 7 programming concepts, these concepts are common or illustrative to some degree in many, if not all programming languages. learning these concepts will help you understand python, bash, javascript and many others. [[variables]] | [[input]] | /output/ | [[basic-math]] | [[loops]] | [[conditionals]] | [[functions]] until output commands are used, variables and input commands only result in information being accessible to the program itself. it can process numbers, strings, pictures and more, though it wont tell you anything. only the program will know, which is of little purpose to the user. output commands let the program interact with the real world, and also with other programs. theyre often as simple as input commands. the most famous output command is the print command. it is called this because before every computer had a screen, computers printed output on paper, with a computerised typewriter[lit]/[lit]printer called a teletype. also the word "print" means "to write out," and given a screen, the computer will "write out" to the screen. here is a variable: height here we set the variable: height 5 here we print the variable: height 5 print output is so important, that the most classic[lit]/[lit]famous programming example for beginners is called "hello world"-- which demonstrates output. here is "hello world" in quasi: now "hello world" print first we set the variable now to "hello world," then we print it. as a result, the words "hello world" show up on the screen. the quotes in our code let the computer know the data is a string, but the quotes are not part of the string and are not displayed when the string is output. the output window just says: hello world you can also change the colour of the output: now = "hello world" ; color 5 ; print we added = and ; to make the code debatably easier to read, but they are not required in quasi. they show the variable now being set to "hello world" and they show that *color* is a different command, one that changes the colour of your text. in quasi, both "color" and "colour" do the same thing. quasi has 16 colours, which you do not need to memorise though if you change colours often enough you probably will memorise the table. the table has two rows, and the first 8 colours (from 0 to 7) are: 0 black 1 blue 2 green 3 cyan 4 red 5 magenta 6 brown 7 white so "colour 5" means "change the colour to magenta." the other row of colours are a brighter version of the first row: 0 black 1 blue 2 green 3 cyan 4 red 5 magenta 6 brown 7 white 8 grey 9 light blue 10 light green 11 light cyan 12 light red 13 pink 14 yellow 15 bright white quasi did not create named commands for these colours, but you if you want to use names instead of numbers, variables let you do that. simply add this code to the beginning of your program, and you can name the colours whatever you like: black = 0 blue = 1 green = 2 teal = 3 red = 4 purple = 5 brown = 6 offwhite = 7 grey = 8 skyblue = 9 lime = 10 turquoise = 11 tomato = 12 pink = 13 yellow = 14 white = 15 now = "r" ; colour red ; prints now = "a" ; colour brown ; prints now = "i" ; colour yellow ; prints now = "n" ; colour lime ; prints now = "b" ; colour skyblue ; prints now = "o" ; colour purple ; prints now = "w" ; colour blue ; print ; colour black ; highlight -1 [img]rainbow.png[img] the print command outputs text and then goes to the next line-- this is the default behaviour for many versions of the print command. prints does the same thing as the print command, but stays on the same line. *highlight* does the same thing for the background colour that *colour* does for the foreground colour. for either command, -1 means "unspecified"-- the default browser colour. variables, input and output make it possible for a coder to reference information, get information and offer information to the user. [[basic-math]] and loops and conditionals make our programs more powerful and useful. functions make our programs easier and faster to read and maintain.
back to quasi concepts: [url][url] quasi main page: [url][url] home: [lit][lit]