Professional Web Applications Themes

print with no arguments? - Ruby

I feel that the Ruby interpreter is poking fun at me with this error: findcols.rb:84:in `print': wrong number of arguments(1 for 0) (ArgumentError) The script does indeed run without errors as soon as I remove the argument from print, but what sense should that make? The culprit line with a little context: (0..peak).each do |n| (size-1).each {|i| print "*" if ul[i] > n} puts end -- Oliver Cromm...

  1. #1

    Default print with no arguments?

    I feel that the Ruby interpreter is poking fun at me with this error:

    findcols.rb:84:in `print': wrong number of arguments(1 for 0)
    (ArgumentError)

    The script does indeed run without errors as soon as I remove the
    argument from print, but what sense should that make? The culprit line
    with a little context:

    (0..peak).each do |n|
    (size-1).each {|i| print "*" if ul[i] > n}
    puts
    end
    --
    Oliver Cromm
    Oliver Guest

  2. #2

    Default Re: print with no arguments?

    On Wed, 25 Feb 2004, Oliver Cromm wrote:
     

    perhaps you have another 'def print...' in scope somewhere which does NOT take
    an argument? are you sure that your entire source file (or something you've
    required) has not defined a print?

    -a
    --
    ================================================== =============================
    | EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
    | PHONE :: 303.497.6469
    | ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328
    | URL :: http://www.ngdc.noaa.gov/stp/
    | TRY :: for l in ruby perl;do $l -e "print \"\x3a\x2d\x29\x0a\"";done
    ================================================== =============================

    Ara.T.Howard Guest

  3. #3

    Default Re: print with no arguments?

    On Feb 25, 2004, at 13:44, Oliver Cromm wrote:
     

    Have you perhaps overridden print somewhere in your code?


    Nathaniel

    <:((><



    Nathaniel Guest

  4. #4

    Default Re: print with no arguments?

    "Ara.T.Howard" <ngdc.noaa.gov> wrote:
     
    > perhaps you have another 'def print...' in scope somewhere which
    > does NOT take an argument?[/ref]

    Indeed, that's it. So I was poking fun at me myself. I'll quickly
    change the name of that "print" function!

    Thanks!
    --
    Oliver Cromm
    Oliver Guest

  5. #5

    Default Re: print with no arguments?

    Hey

    Oliver Cromm <uqam.ca> writes:
     
    > > perhaps you have another 'def print...' in scope somewhere which
    > > does NOT take an argument?[/ref]
    >
    > Indeed, that's it. So I was poking fun at me myself. I'll quickly
    > change the name of that "print" function![/ref]

    even though you found an error it wouldn't hurt if you put it like so

    print("*") if ...

    so that the precedence is clear. The interpreter could have seen it as

    print ("*" if ...)

    which would be runtime problem.

    Cheers!
    Archit
     


    Archit Guest

Similar Threads

  1. Saving Print Settings in a Doent via Print Advanced Menu
    By Janet_A._Thompson@adobeforums.com in forum Adobe Acrobat Macintosh
    Replies: 5
    Last Post: April 20th, 02:50 PM
  2. Creating PDFs from Freehand -- print to PDFvs. export vs. print/scan to PDF?
    By Dan_Kirsch@adobeforums.com in forum Adobe Acrobat Macintosh
    Replies: 0
    Last Post: April 2nd, 11:14 AM
  3. print to pdf doesn't work. queue in the print center stopped
    By Eric_Singhartinger@adobeforums.com in forum Adobe Acrobat Macintosh
    Replies: 3
    Last Post: January 28th, 10:40 PM
  4. 2003 print server not sending print notifications
    By Nina in forum Windows Server
    Replies: 0
    Last Post: July 8th, 04:31 PM
  5. Print with preview on PS 7: Scaled Print Size weird mistake
    By Pep in forum Adobe Photoshop 7, CS, CS2 & CS3
    Replies: 3
    Last Post: September 12th, 10:07 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139