Code Examples
Demonstrating syntax highlighting with multiple languages
JavaScript Example
function greet(name) {
console.log(`Hello, ${name}!`);
return `Welcome to Noorle, ${name}`;
}
greet('Developer');Python Example
def fibonacci(n):
if n <= 1:
return n
return fibonacci(n-1) + fibonacci(n-2)
# Generate first 10 numbers
for i in range(10):
print(f"F({i}) = {fibonacci(i)}")Rust Example
use std::collections::HashMap;
fn main() {
let mut scores = HashMap::new();
scores.insert("Alice", 95);
scores.insert("Bob", 87);
for (name, score) in &scores {
println!("{}: {}", name, score);
}
}Go Example
package main
import (
"fmt"
"net/http"
)
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello, %s!", r.URL.Path[1:])
}
func main() {
http.HandleFunc("/", handler)
http.ListenAndServe(":8080", nil)
}TypeScript Example
interface User {
id: number;
name: string;
email: string;
isActive: boolean;
}
class UserService {
private users: User[] = [];
addUser(user: Omit<User, 'id'>): User {
const newUser: User = {
id: this.users.length + 1,
...user
};
this.users.push(newUser);
return newUser;
}
getActiveUsers(): User[] {
return this.users.filter(user => user.isActive);
}
}