# Sample finish issue?

**URL:** <https://in-thread.sonic-pi.net/t/sample-finish-issue/4486>\
**Category:** Support, Help & Resources\
**Created:** [October 10, 2020, 7:38am UTC](https://in-thread.sonic-pi.net/t/sample-finish-issue/4486 "2020-10-10T07:38:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nlb](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/nlb/32/997_2.png) [@nlb](https://in-thread.sonic-pi.net/u/nlb)\
**Post date:** [October 10, 2020, 7:38am UTC](https://in-thread.sonic-pi.net/t/sample-finish-issue/4486/1 "2020-10-10T07:38:30Z")

</div>

Hi,

```ruby
s = "loop_compus"

sample s, finish: 0.75
sleep 8
sample s , finish: 0.75/3
sleep 8
sample s , finish: 3/4
stop

```

Which line do you think won’t work as expected ?  
Cheers

---

<div class="post-metadata">

**Author:** ![ethancrawford](https://avatars.discourse-cdn.com/v4/letter/e/a88e4f/32.png) [@ethancrawford](https://in-thread.sonic-pi.net/u/ethancrawford)\
**Post date:** [October 10, 2020, 7:56am UTC](https://in-thread.sonic-pi.net/t/sample-finish-issue/4486/2 "2020-10-10T07:56:18Z")

</div>

This might not be obvious unless you’re aware of the way Ruby handles division 🙂  
In Ruby, if you divide two integer numbers, _the result also becomes an integer_.  
So here, since 3 / 4 is calculated as 0.75 _but the numbers involved are both integers_, a result of 0 is returned.  
To make it return the desired result instead, at least one of the numbers needs to eg. be a float:  
`3/4.0` will work, as will `3.0/4`, or you can use `.to_f` on one of them, etc.

---

<div class="post-metadata">

**Author:** ![nlb](https://dub1.discourse-cdn.com/flex017/user_avatar/in-thread.sonic-pi.net/nlb/32/997_2.png) [@nlb](https://in-thread.sonic-pi.net/u/nlb)\
**Post date:** [October 10, 2020, 9:03am UTC](https://in-thread.sonic-pi.net/t/sample-finish-issue/4486/3 "2020-10-10T09:03:29Z")

</div>

yep @ethancrawford i guessed it was about this but try to explain this to 13-14 old pupils 🙂 good luck. It’s the chance to introduce variable types.
