Python

Matrix movie still

How to Use Command Line (10 Commands) Windows & Mac

1. Alias With the command line, you can create an alias for a command. As an example, let’s create an alias surf that opens up medium.com. To open up medium.com via the command line you need to use open [URL] syntax: To create an alias surf for this command: 2. Create a new alias surf by adding the following into the .bash_profile: 3. Save the file and restart the

How to Use Command Line (10 Commands) Windows & Mac Read More »

Lambdas in Python

Lambdas in Python

Lambdas in Python are anonymous functions that take any number of arguments but only contain a single expression. As an example, here is a lambda that multiplies a number by three: This lambda isn’t particularly useful as-is because there’s no way to call it. However, you could assign it to a variable and then call

Lambdas in Python Read More »

getters and setters in swift

Swift get set—How Computed Properties (Getters & Setters) Work?

In Swift, properties are either stored properties or computed properties. Getters and setters in Swift are the methods a computed property uses to either set or get a value on-demand. Syntactically, accessing a computed property looks the same as accessing a stored property. For instance, let’s access the computed property kilos of a weight instance: The point is that it runs a piece

Swift get set—How Computed Properties (Getters & Setters) Work? Read More »

Enums in Swift

Enums in Swift tie related values together in a type-safe way. For example, instead of calling a direction “Up” or “Down” in your program, you should create an enum that couples these options together: Then you can call Direction.Up or Direction.Down. A Common Use Case for Enums in Swift Say you have an app that needs to control the direction of the game character

Enums in Swift Read More »