CODEX

Photo by Ilija Boshkov on Unsplash

1. Shorter If…Else Statements with Ternary Operators

let money = 100if money > 0 {
print("Some money")
} else {
print("No money")
}
money > 0 ? print("Some money") : print("No money")

2. Destructuring Tuples

func getInfo() -> (name: String, email: String) {
return (name: "Matt", email: "matt@example.com")
}


Learn how to add a continuously flowing smooth animated gradient to your app.

Setting Up a Gradient

Choosing the colors

Using the Colors

let color1: CGColor = UIColor(red: 209/255, green: 107/255, blue: 165/255, alpha: 1).cgColorlet color2: CGColor = UIColor(red: 134/255, green: 168/255, blue: 231/255, alpha: 1).cgColorlet color3…


CODEX

Learn what are structures and classes, what are the key differences and how to choose between them.

Photo by Markus Winkler on Unsplash

A Brief Comparison

The Key Difference


JavaScript shorthands to make your code clean and concise

Drawing of monitor displaying code
Drawing of monitor displaying code
Image credit: Author

1. One-Liner If-Else Statements

if (10 < 100) {
console.log("True");
} else {
console.log("False");
}
True
10 < 100 ? console.log("True") : console.log("False");
True
condition ? trueExpression : falseExpression


Learn a bunch of one-liners to improve code readability

Laptop on desk
Laptop on desk
Photo by Maxwell Nelson on Unsplash.

1. One-Liner If-Else Operator

money > 0 ? print("Some money") : print("No money")
condition ? true_expression : false_expression

2. Swap Two Variables Without a Helper


Useful tips and tricks that I use every day

Glow-in-the-dark plugs
Glow-in-the-dark plugs
Photo by Murat Onder on Unsplash.

1. Swap Two Variables With One Line of Code

a = 1
b = 2
a, b = b, a

2. Duplicate Strings Without Looping

name = "Banana"
print(name * 4)
BananaBananaBananaBanana

3. Reverse a String

sentence = "This is just a test"
reversed = sentence[::-1]
print(reversed)


Make a function accept any number of arguments by using *args and **kwargs

Woman using laptop
Woman using laptop
Photo by Christina @ wocintechchat.com on Unsplash.

Args in Python

numbers = [1,2,3]mySum(*numbers)…


Boost your Golang program by running multiple tasks at the same time

Go mascot on a running track
Go mascot on a running track
Original Photo by Adi Goldstein on Unsplash.

What Are Goroutines?


Make your coding life easier with these amazing command-line tools

Old keyboard
Old keyboard
Photo by Troy Chen on Unsplash.

1. Taskwarrior


Learn what closures and anonymous functions are with simple and helpful examples

Code
Code
Photo by Irvan Smith on Unsplash.

What Are Anonymous Functions in Go?

Example

Artturi Jalli

Entrepreneur, Software Engineer, Mobile App Dev, Physics Student from Finland. Check out my brand new blog at https://www.codingem.com/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store