Help me please for return functions

Form send frame field:

def fio=(fname)
puts fname
end

puts fio - all goods!

change:

def fio=(fname)
return fname
end

puts fio - empty string :frowning:

The example code is insufficient to deduce what you do and which result
you hope for.

Can you please give an authentic example-usage of the function?

Your first attempt to puts() the return value of a call to puts() should
print nothing at all, as puts() returns nil and you call fio() without
arguments. What do you call “all goods!"?

Michael U. wrote in post #1162481:

The example code is insufficient to deduce what you do and which result
you hope for.

Can you please give an authentic example-usage of the function?

Your first attempt to puts() the return value of a call to puts() should
print nothing at all, as puts() returns nil and you call fio() without
arguments. What do you call “all goods!"?

Ok.

https://github.com/lemial/RubyDesk/blob/master/app/models/concerns/create_from_user.rb

This concern for creating ticket, if user not found - create, foundation
of email, we need add full_name (fname) for created user and added
user_id to ticker tables.

Mike Levchenko wrote in post #1162483:

https://github.com/lemial/RubyDesk/blob/master/app/models/concerns/create_from_user.rb


def fio=(fname)
return ‘Test’
end

If you call

puts fio(‘Audo Abu Taji’) or
puts(fio(‘Your Mama’))

the program will print ‘Test’ in each case.

Calls to fio without argument, like in
puts fio
puts(fio() )

Will give you an empty string, as nothing had been stored in an
attribute of name ‘fio’. The argument fname is ignored in your code.

What do you expect and what does not work ?

You should initialize your objects and you do not need a method fio=(),
if you plan to define attribute-accessors anyway!