# Quirky Curses behavior?

**URL:** <https://www.ruby-forum.com/t/quirky-curses-behavior/99233>\
**Category:** Ruby\
**Created:** [July 21, 2006, 6:20am UTC](https://www.ruby-forum.com/t/quirky-curses-behavior/99233 "2006-07-21T06:20:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![xmg-eric](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/f04885/32.png) [@xmg-eric](https://www.ruby-forum.com/u/xmg-eric)\
**Post date:** [July 21, 2006, 6:20am UTC](https://www.ruby-forum.com/t/quirky-curses-behavior/99233/1 "2006-07-21T06:20:29Z")

</div>

#!/usr/bin/env ruby

require ‘curses’  
include Curses

i = 60

# Works

puts (i / 60).to\_s

# Works

if (i % 60 == 0) then  
puts (i / 60).to\_s  
end

# Works

addstr (i / 60).to\_s

# Error: in `addstr’: can’t convert Fixnum to string

if (i % 60 == 0) then  
addstr (i / 60).to\_s  
end

---

<div class="post-metadata">

**Author:** ![xmg-eric](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/f04885/32.png) [@xmg-eric](https://www.ruby-forum.com/u/xmg-eric)\
**Post date:** [July 21, 2006, 6:32am UTC](https://www.ruby-forum.com/t/quirky-curses-behavior/99233/2 "2006-07-21T06:32:58Z")

</div>

On Jul 21, 2006, at 12:18 AM, Eric A. wrote:

> # Works
> 
> end

try running your script like this:

ruby -w

I think you’ll notice something interesting is happening when it gets  
to that line.

---

<div class="post-metadata">

**Author:** ![xmg-eric](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/f04885/32.png) [@xmg-eric](https://www.ruby-forum.com/u/xmg-eric)\
**Post date:** [July 21, 2006, 9:16am UTC](https://www.ruby-forum.com/t/quirky-curses-behavior/99233/3 "2006-07-21T09:16:40Z")

</div>

For those reading this thread who don’t want to take the time to  
follow up on Logan Copaldo’s ( (excellent) suggestion, here is some  
code contemplate. Parentheses matter.

Regards, Morton

#! /usr/bin/ruby -w

require ‘curses’  
include Curses

init\_screen  
begin  
i = 60  
# Works  
addstr((i / 60).to\_s)  
addstr("\n")  
# Works  
addstr((i / 60).to\_s) if (i % 60 == 0)  
addstr("\nPress any key to proceed: ")  
refresh  
getch  
ensure  
close\_screen  
end
