On Thu, 15 Mar 2001, Paul Pladijs wrote:
> The following code takes a fixnum and transforms it to a string. 
> If the fixnum is a one digit number, a prefix will be added. The 
> code is useful to display numbers in a "digital clock" way.
>   def format_to_2digits (no)
>     # Precondition: no.type == Fixnum
>     str = no.to_s
>     str[0, 0] = "0" if str.size == 1 else str
>   end

      if str.size==1 then str[0, 0] = "0" else str end

because the postfix form of "if" doesn't have an "else".

but then, you can rewrite the whole as:

def format_to_2digits(no)
	sprintf "%02d", no
end

matju