This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// Outside here is global scope | |
| var global_var = 90; | |
| let global_let = 10; | |
| let ten = 10; // initial value is 10. Operation is called Initialisation | |
| ten = 100; /// the value it stores becomes 100. Operation: Assignment | |
| var twenty = 20; //initial value is 20. Operation is called Initialisation | |
| twenty = 30 // becomes 30, Operation: Assignment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var x = 3; | |
| console.log("Global x: %s", x); | |
| function func(randomize) { | |
| console.log("Global x: %s", x); | |
| if (randomize) { | |
| var x = Math.random(); // (A) scope: whole function | |
| console.log("Local x: %s\n", x); | |
| return x; | |
| } | |
| console.log("Which x?: %s\n", x); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| namespace tests | |
| { | |
| template <class T> | |
| void print(T& cont) | |
| { | |
| for(auto& ele: cont) | |
| cout << ele << ' '; | |
| } | |
| template <class T> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <SDL2/SDL.h> | |
| #include <iostream> | |
| #include <vector> | |
| #include <thread> | |
| #include <stdlib.h> | |
| #include <time.h> | |
| using namespace std; | |
| void DrawRec(SDL_Renderer* renderer, SDL_Rect r) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| These commands are based on a askubuntu answer http://askubuntu.com/a/581497 | |
| To install gcc-6 (gcc-6.1.1), I had to do more stuff as shown below. | |
| USE THOSE COMMANDS AT YOUR OWN RISK. I SHALL NOT BE RESPONSIBLE FOR ANYTHING. | |
| ABSOLUTELY NO WARRANTY. | |
| If you are still reading let's carry on with the code. | |
| sudo apt-get update && \ | |
| sudo apt-get install build-essential software-properties-common -y && \ | |
| sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \ |