This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while(1 < 2){ | |
console.log("This is just an example."); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UIApplication { | |
func handleKeyboard() { | |
guard let window = windows.first else { return } | |
let tapRecognizer = UITapGestureRecognizer(target: window, action: #selector(UIView.endEditing)) | |
tapRecognizer.cancelsTouchesInView = false | |
tapRecognizer.delegate = self | |
window.addGestureRecognizer(tapRecognizer) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
// FUNCTIONS | |
// specify the argument type(s) and the possible return value type | |
func sum(x int, y int) int { | |
return x + y | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main() { | |
fmt.Println("Hello, world!") | |
// Creating variables | |
var x1 int = 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main() { | |
// POINTERS | |
i := 7 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
// STRUCTURES - a collection of fields to construct a logical type | |
type Fruit struct { | |
name string | |
color string | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Name": "Charlie", | |
"Street address": "Student Street 32", | |
"Graduated": false, | |
"Allergies": ["Banana", "Apple", "Nuts"], | |
"Grades": { | |
"Physics": 4, | |
"Maths": 4, | |
"Chemistry": 5 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"Name": "Charlie", | |
"Street address": "Student Street 32", | |
"Graduated": false, | |
"Allergies": ["Banana", "Apple", "Nuts"], | |
"Grades": { | |
"Physics": 4, | |
"Maths": 4, | |
"Chemistry": 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const students_data = [ | |
{ | |
"Name": "Charlie", | |
"Street address": "Student Street 32", | |
"Graduated": false, | |
"Allergies": ["Banana", "Apple", "Nuts"], | |
"Grades": { | |
"Physics": 4, | |
"Maths": 4, | |
"Chemistry": 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def square_even(numbers): | |
for number in numbers: | |
if number % 2 == 0: | |
yield(number * number) | |
numbers = [1, 2, 3, 4, 5, 6] | |
squared_numbers = square_even(numbers) | |
for number in squared_numbers: | |
print(number) |
OlderNewer