Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #7237

Re: Using functions to return something

From jacki <collector@idealan.pl>
Newsgroups comp.lang.ruby
Subject Re: Using functions to return something
Date 2016-04-20 10:30 +0200
Organization ATMAN - ATM S.A.
Message-ID <57173E1C.2050905@idealan.pl> (permalink)
References <b1e27c74-cf34-49c3-a4a1-85f55f0e55cd@googlegroups.com> <dnn7koFrj3gU1@mid.individual.net> <69f480e7-0d0b-4fc7-bd69-49fc2f6540c4@googlegroups.com>

Show all headers | View raw


W dniu 2016-04-20 o 07:28, Cai Gengyang pisze:
> 
> This is what I did :
> 
> I created a file , defined a new variable c and saved it as ex50.rb ---
> 
> def add(a, b, c)   

a, b and c - three arguments

> 
> age = add(30, 10) / 5 
> 

then you are calling function with two arguments and divide what
function returns by 5 - really?

And remember, that 7/3 = 2 not 2.333(3) because:
2.2.0 :005 > 7.class
 => Fixnum

and Fixnum / Fixnum = Fixnum

Back to comp.lang.ruby | Previous | NextPrevious in thread | Find similar


Thread

Using functions to return something Cai Gengyang <gengyangcai@gmail.com> - 2016-04-19 07:06 -0700
  Re: Using functions to return something Robert Klemme <shortcutter@googlemail.com> - 2016-04-19 19:19 +0200
    Re: Using functions to return something Cai Gengyang <gengyangcai@gmail.com> - 2016-04-19 22:28 -0700
      Re: Using functions to return something Sebastian Christ <rudolfo.christ@gmail.com> - 2016-04-20 09:25 +0200
        Re: Using functions to return something Cai Gengyang <gengyangcai@gmail.com> - 2016-04-20 04:12 -0700
          Re: Using functions to return something Sebastian Christ <rudolfo.christ@gmail.com> - 2016-04-20 15:42 +0200
            Re: Using functions to return something Kaz Kylheku <545-066-4921@kylheku.com> - 2016-04-20 14:34 +0000
              Re: Using functions to return something Sebastian Christ <rudolfo.christ@gmail.com> - 2016-04-20 20:48 +0200
                Re: Using functions to return something Kaz Kylheku <545-066-4921@kylheku.com> - 2016-04-20 19:27 +0000
      Re: Using functions to return something jacki <collector@idealan.pl> - 2016-04-20 10:30 +0200

csiph-web