12 lines
165 B
Plaintext
12 lines
165 B
Plaintext
|
# A test for templates
|
||
|
import std;
|
||
|
|
||
|
|
||
|
template sum[T: Integer](a, b: T): T {
|
||
|
a + b;
|
||
|
}
|
||
|
|
||
|
|
||
|
print(sum(1, 2) == 3); # true
|
||
|
print(sum(1'i32, 2'i32) == 3'i32); # true
|