| 1 | // vtest build: present_ruby? // the example only makes sense to be compiled, when ruby is installed |
| 2 | module test |
| 3 | |
| 4 | import math |
| 5 | |
| 6 | @[export: 'square'] |
| 7 | fn square(i int) int { |
| 8 | return i * i |
| 9 | } |
| 10 | |
| 11 | @[export: 'sqrt_of_sum_of_squares'] |
| 12 | fn sqrt_of_sum_of_squares(x f64, y f64) f64 { |
| 13 | return math.sqrt(x * x + y * y) |
| 14 | } |
| 15 |