Created
July 14, 2020 17:22
-
-
Save yakkomajuri/7b911e65cf1fcd1d103665e805dd0866 to your computer and use it in GitHub Desktop.
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
import strformat | |
# Example taken from the Nim Website: https://nim-lang.org/ | |
type | |
Person = object | |
name: string | |
age: Natural # Ensures the age is positive | |
let people = [ | |
Person(name: "John", age: 45), | |
Person(name: "Kate", age: 30) | |
] | |
for person in people: | |
# Type-safe string interpolation, | |
# evaluated at compile time. | |
echo(fmt"{person.name} is {person.age} years old") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment