I embrace semicolons myself and it's more readable too. But the automatic semicolon insertion just might be useful in code golfing scenarios? In this example:
return
something;
will be converted into:
process.stdin.resume(); //Keep process from terminating. | |
const readline=require("readline"), | |
rl=readline.createInterface({ | |
input:process.stdin, | |
output:process.stdout | |
}); | |
function question(string){ | |
return new Promise(resolve=> | |
rl.question(string+"\n",answer=>resolve(answer)) | |
); |
// title: Perlin Noise | |
// author: Anastasia Dunbar | |
// script: js | |
var width=240,height=136; | |
function mix(a,b,t){return(t*(b-a))+a;} | |
function mod(a,b){return((a%b)+b)%b;} | |
function fract(x){return x-Math.floor(x);} | |
function clamp(a,b,c){return Math.min(Math.max(a,b),c);} | |
function dot(a,b){for(var s=0,i=0;i<a.length;i++){s+=a[i]*b[i];}return s;} | |
function sign(x){return x>0?1:x<0?-1:0;} |
{ | |
"Drum machines":[ | |
{"name":"Roland TR-606 Drumatix","description":"A programmable analog synthesis drum machine."}, | |
{"name":"Roland TR-707 Rhythm Composer","description":"A programmable digital sample-based drum machine."}, | |
{"name":"Roland TR-808 Rhythm Composer","description":"An analog subtractive synthesis drum machine."}, | |
{"name":"Roland TR-909 Rhythm Composer","description":"A drum machine with samples alongside analog sounds."}, | |
{"name":"Korg Volca Beats","description":"An analog drum machine."}, | |
{"name":"Akai MPC60","description":"An electronic sampler."}, | |
{"name":"Pearl Fightman Electronic Training Drum","description":"An analog FM drum synth module."} | |
], |
function dsp(time){ | |
var master=Math.sin(Math.PI*2*440*time)*Math.exp(-3*time); | |
return master; | |
} | |
var audioContext=new AudioContext(), | |
bufferSize=2048, //256,512,1024,2048,4096,8192,16384 | |
node=audioContext.createScriptProcessor(bufferSize,0,2), //bufferSize,inputChannels,outputChannels | |
time=0; | |
node.onaudioprocess=event=>{ | |
var L=event.outputBuffer.getChannelData(0), |
import PIL | |
from PIL import Image | |
from PIL import ImageGrab | |
import os | |
while(True): | |
while(True): | |
imageName=input("Enter filename: ") | |
if(os.path.isfile(imageName)): #File exists? | |
image=Image.open(imageName) | |
break |
// - - Hello World - - | |
#include <iostream> //For input and output. | |
using namespace std; //"std::cout" into "cout". | |
int main(){ | |
cout<<"Hello, world!\n"; | |
return 0; | |
} | |
/*C version: |
var small={ | |
"noll":0, | |
"ett":1, //Only idiots say "en" as a number. | |
"två":2, | |
"tre":3, | |
"fyra":4, | |
"fem":5, | |
"sex":6, | |
"sju":7, | |
"åtta":8, |
var alphabet=[ | |
{letter:"a",consonant:false}, | |
{letter:"b",consonant:true}, | |
{letter:"c",consonant:true}, | |
{letter:"d",consonant:true}, | |
{letter:"e",consonant:false}, | |
{letter:"f",consonant:true}, | |
{letter:"g",consonant:true}, | |
{letter:"h",consonant:true}, | |
{letter:"i",consonant:false}, |