Page MenuHomePhabricator

The Swap File
Updated 2,580 Days AgoPublic

I got tired of forgetting syntax when I switch between languages, so I'm starting this wiki page. If we make it extensive enough, it might just be publication-worthy someday!


Each language entry should show the following, in the following order.

Doc Comment
Multiline Comment
Multiline Doc Comment
Resolve namespaces
Declare integer "foo" as 3
Declare string "bar" as "Hello, world!"
Function "say"...
   Accept string (message), string (caller), and integer (repeat number).
   Print as "msg (caller, num)"
   Return type boolean, return true.
   For example, the second permutation of the "while" statement should call msg with "while", 2, and bar
If foo > 0, call msg.
Declare integer "i" as 0.
While i < foo, call msg and increment i.
For n > foo, call msg.


///Doc Comment
/*Multiline Comment*/
/**Multiline Doc Comment*/

#include <string>
#include <iostream>
#include "myFile.hpp"

//Resolve namespaces.
using std::string;

//Declare variables.
string bar = "Hello, world!";

bool say(string msg, string caller, int time)
   std::cout << msg << "(" << caller << ", " << std::to_string(time) << ")" << endl;
   return true;

//If statement.
if(foo > 0)
   //Print out.
   say(bar, "If", 1);

int i = 0;

//While loop.
while(i < foo)
   //Print out.
   say(bar, "While", i+1);

//For loop.
for(int n = 0; n < foo; n++)
   //Print out.
   say(bar, "For", n+1);
Last Author
Last Edited
Jul 22 2015, 8:45 PM

Event Timeline

jcmcdonald edited the content of this document. (Show Details)