The fact that Chris Sawyer chose Assembly language to write a complex game like RCT is just. You're actually manipulating memory directly. It gets a **LOT** more complex than this, but the Javascript version is going to look more 'wordy' and the Assembly looks less wordy and more complex. It is less 1 line but it is a lot harder to understand what is going on. Javascript (and other languages OTHER than Assembly) already have a LOT of the work done for you already.Īssembly looks more like this: mov eax, 2 It isn't that hard to understand because it uses words we're used to and makes sense. Okay, so that's a very basic way to add 2 numbers together in Javascript. This line just spits out the result into a diagnostic window that we can look at: console.log(result) The following line is where the actual math happens, and of course, the variable 'result' ends up having a value of 4 just like basic math. You can name variables anything you want. ![]() So "var firstNumber = 2" and "var secondNumber = 2" is telling the computer that you want to create 2 variables with the name 'firstNumber' and 'secondNumber' and give them the value of 2. "var" is a keyword that the computer understands that tells it that you want to create a variable, which is just something that holds a value of some kind (which can be a number, some text, a score, a name, etc). Here are a few lines of code that would add two numbers together (bear with me, I will explain these line by line) var firstNumber = 2 Let's say you wanted to add 2 numbers together in Javascript, a *very* common programming language used on the internet for websites. Got a suggestion for a new flair? Send us a modmail!Īlong with my other analogy that /u/Rumchunder posted, here's a little bit more of a technical explanation, if you're curious, but I'll keep it as simple as I can but it might go above ELI5.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |