John-Li/my_programs — comment on commit 201ac930ed88e95879ea1184f9a09d1eb10efeaa
File: book/task10.rb line 21
By gmile:

Due to performance reasons, you should avoid calling functions which are expected to return the same value more then once. Just calculate it once, save the value, and then use it as much times as you want. This will prevent calculating same things multiple times which will impact performance in a good way.

So if you need to get a `katet_unkn` with the same parameters (in your example you call `katet_unkn(c, a)` three times) it's much better to store the value it returns somewhere, and then simple use it twice. I.e.:

```ruby
...
katet = katet_unkn(c, a)

puts "Unknown katet is #{katet}"
puts "Radius of the inscribed circle is #{radius(a, katet, c, halfperimetr(a, katet, c))}"
```