Rígille's programming guide
i’m still writing that guide, expect drafts and changes.
also feel free to make suggestions with an issue or a pull request. 🙂
Introduction
Computers can help people in many many different ways. When told to, they can draw a webpage, put you inside a game world, point a rocket towards space, prove theorems… I can’t think of any other machine that can do so many things. However if you’re here I suppose they don’t do exactly what you need yet. But you can change that and I’d like to help you figure out how.
Your first program
When you need someone to do something for you the only way to get that is to ask them. When you need a computer to do something it works like that too. However computers are dumb machines that can only read machine code. So should we write machine code for them?
You could. You’re a smart person. However that would be a lot of work. Also the computer would be telling you what to do and we need it to be the other way around. What we’ll do instead is to write in a language that’s easy for both computers and people to understand. That’s a programming language. The one we’ll use is called Kind, and we’ll use it because its simple and lets you say a lot.
So how do we say hello in Kind?
TODO: syntax highlight, opção de rodar e dar typecheck no programa, dar nome aos exemplos e numerar linhas dos programas
Test: String
?hole
(caixa de output)
Replace ?hole
in line 1 with "hello, world!"
and press the typecheck button at the top right. If you get an ok then press run. Now if you see “hello, world!” showing up congratulations! You wrote your first program. That makes you a Kind programmer — welcome!
Our program has three main parts
_Test_: String
"hello, world!"
Test
is the name of our program. We called it like that because we were just testing something. However we could have a name that tells us more. For example
Cutest: String
"Mélani"
Now the program is the name of my cat, Mélani, which is of course the cutest thing in the world.