Code Examples

Examples With Multiple Languages

Multilanguage Code Samples
// Arrow function sample
const arrowFuncSample = () => {
console.log('this is an arrow function example');
};

Example With One Language

JavaScript

JavaScript Code SampleJavaScript
// Arrow function sample
const arrowFuncSample = () => {
console.log('this is an arrow function example');
};

Java

public class MyClass {
public static void main(String[] args) {
System.out.println("Hello World");
}
}

Scala

object HelloWorld {
def main(args: Array[String]) {
println("Hello, world!")
}
}

CSharp

CSharp Code SampleC#
using System;
namespace HelloWorld {
class Starter {
static void Main(string[] args) {
Console.WriteLine("Hello World!");
}
}
}

cURL

Curl Code SamplecURL
curl --request POST \
--url https://api.sendgrid.com/v3/mail/send \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{"personalizations": [{"to": [{"email": "recipient@example.com"}]}],"from": {"email": "sendeexampexample@example.com"},"subject": "Hello, World!","content": [{"type": "text/plain", "value": "Heya!"}]}'

GraphQL

GraphQL Code Samplegraphql
type Person {
id: ID!
name: String!
age: Int
}

JSON

{
"petType": "Tarantula",
"name": "Squishy"
}

PHP

<!DOCTYPE html>
<html>
<head>
<title>Hello World Example</title>
</head>
<body>
<?php
echo "Hello world!";
?>
</body>
</html>

Shell

#!/bin/sh
echo Hello World

TypeScript

function sayHello(name: string) {
console.log(`Hello ${name}`);
}

YAML

- title: Menu
pages:
- title: Home
path: /home
- title: About
path: /about
- title: Products
path: /products
- title: Contact
path: /contact