Skip to content

Instantly share code, notes, and snippets.

View o-nnerb's full-sized avatar

Brenno de Moura o-nnerb

View GitHub Profile
class Animal {
func makeNoise() {
print("Unknown animal!")
}
}
class Dog: Animal {
override func makeNoise() {
print("The dog goes woof!")
}
func makeNoise(animal: Animal) {
switch animal {
case let dog as Dog:
print("The dog goes woof!")
case let cat as Cat:
print("The cat goes meow!")
case let bird as Bird:
print("The bird goes tweet!")
default:
print("Unknown animal!")
func multiplyNumbers(_ firstNumber: Int, by secondNumber: Int) -> Int {
return firstNumber * secondNumber
}
func foo(a: Int, b: Int) -> Int {
return a * b
}
// Initializes i with zero
int i = 0;
# Check if a user has an "admin" type
def check_admin_permission(user):
if user.type == 'admin':
return True
else:
return False
# Calculates the mean of a list of numbers
def calculate_mean(numbers):
total = sum(numbers)
return total / len(numbers)
# Function that calculates the average of a list of numbers
# Version 2.0, updated on 2022-05-01 by João Silva
# Last modification: 2022-05-01 14:30:00 (Brasilia time)
def calculate_mean(numbers):
total = sum(numbers)
return total / len(numbers)
import Injection
import Domain
protocol LoginInteractorInput {
func validate(email: String)
func validate(password: String)
func login(_ email: String, _ password: String)
import Foundation
protocol LoginPresenterInput {
func emailDidChange(_ email: String)
func passwordDidChange(_ password: String)
func submit()
}