mirror of
https://github.com/vlang/v.git
synced 2025-08-04 02:07:28 -04:00
15 lines
304 B
V
15 lines
304 B
V
// vtest build: present_ruby? // the example only makes sense to be compiled, when ruby is installed
|
|
module test
|
|
|
|
import math
|
|
|
|
@[export: 'square']
|
|
fn square(i int) int {
|
|
return i * i
|
|
}
|
|
|
|
@[export: 'sqrt_of_sum_of_squares']
|
|
fn sqrt_of_sum_of_squares(x f64, y f64) f64 {
|
|
return math.sqrt(x * x + y * y)
|
|
}
|