Examples

Let's take a look at some code examples, and how you'd create them with voice.

Hello world

Here's a simple hello world program:

Python

print("hello world")
add print in quotes hello world

JavaScript

console.log("hello world");
add print in quotes hello world

Java

System.out.println("hello world");
add print in quotes hello world

Fizzbuzz

Here's a fizzbuzz program—if a number is divisible by 3, then fizz is printed; if a number is divisible by 5, then buzz is printed; if a number is divisible by both 3 and 5, then fizzbuzz is printed.

Python

for i in range(100):
    if i % 3 == 0 and i % 5 == 0:
        print("fizzbuzz")
    elif i % 3 == 0:
        print("fizz")
    elif i % 5 == 0:
        print("buzz")
add for i in range of one hundred
add if i mod three double equals zero and i mod five double equals zero
add print in quotes fizzbuzz
add if i mod three double equals zero
add print in quotes fizz
add if i mod five double equals zero
add print in quotes buzz

JavaScript

for (let i = 0; i < 100; i++) {
    if (i % 3 == 0 && i % 5 == 0) {
        console.log("fizzbuzz");
    }
    else if (i % 3 == 0) {
        console.log("fizz");
    }
    else if (i % 5 == 0) {
        console.log("buzz");
    }
}
add for
type let i equals zero
right type i less than one hundred
right type i plus plus
add if i mod three double equals zero and i mod five double equals zero
add print in quotes fizzbuzz
add if i mod three double equals zero
add print in quotes fizz
add if i mod five double equals zero
add print in quotes buzz

Java

for (int i = 0; i < 100; i++) {
    if (i % 3 == 0 && i % 5 == 0) {
        System.out.println("fizzbuzz");
    }
    else if (i % 3 == 0) {
        System.out.println("fizz");
    }
    else if (i % 5 == 0) {
        System.out.println("buzz");
    }
}
add for
type int i equals zero
right type i less than one hundred
right type i plus plus
add if i mod three double equals zero and i mod five double equals zero
add print in quotes fizzbuzz
add if i mod three double equals zero
add print in quotes fizz
add if i mod five double equals zero
add print in quotes buzz

Data Class

Here's a simple data class with a getter and setter.

Python

class Dog(Animal):
    def __init__(self, name):
        self.name = name

    def get_name(self):
        return self.name

    def set_name(self, name):
        self.name = name
add class dog
add parent animal
add method in double underscores init
add parameter name
add self dot name equals name
add method get name
add return self dot name
add method set name
add parameter name
add self dot name equals name

JavaScript

class Dog extends Animal {
    constructor(name) {
        this.name = name;
    }

    getName() {
        return self.name;
    }

    setName(name) {
        this.name = name;
    }
}
add class dog
add extends animal
add method constructor
add parameter name
add this dot name equals name
add method get name
add return this dot name
add method set name
add parameter name
add this dot name equals name

Java

class Dog extends Animal {
    public Animal(name) {
        this.name = name;
    }

    public String getName() {
        return self.name;
    }

    public void setName(name) {
        this.name = name;
    }
}
add class dog
add extends animal
add public method capital animal
add parameter name
add this dot name equals name
add public capital string method get name
add return this dot name
add public void method set name
add parameter name
add this dot name equals name

Requests

Here's a function that makes a GET request using the Python requests module:

import requests

def get(url):
    r = requests.get(url)

    return r.text
add import requests
add function get
add parameter url
add r equals requests dot get of url
add return r dot text

Flask

Here's a simple Python web server:

from flask import Flask

app = Flask(__name__)

@app.route("/")
def hello():
    return "hello world"
add from flask import capital flask
add app equals capital flask of double underscores name
add function hello
add return in quotes hello world
add decorator app dot route of in quotes slash

QR Code

Here's a Python program to generate a QR code:

import qrcode

img = qrcode.make("https://google.com")
img.save("qr.png", "PNG")
add import q r code
add i m g equals q r code dot make in parens in quotes h t t p s colon slash slash google dot com
add i m g dot save in parens
add argument in quotes q r dot p n g
add argument in quotes all caps p n g