Question: EDITED\*\*

I've been trying to implement a back button for my ToDoList project.What I'm trying to make it do is on pressing the back button on my phone while the user is typing something in the Editable field which is in the second\_layout(Editable activity),he could go back to the MainActivity without passing data,therefore the first\_layout.I already have a method called saveClick() which basically passes the text input from the Editable field which is in second\_layout back to MainActivity(first\_layout).

This is the method itself.

```
     public void saveClick(View view) {
     String messageString = ((EditText) findViewById(R.id.text_message)).getText().toString();
    if (messageString.equals("")) {
    }
    else {
   Intent intent=new Intent();
   intent.putExtra(IntentCode.INTENT_MESSAGE_CODE,messageString);
   setResult(IntentCode.INTENT_RESULT_CODE,intent);
   finish();
    }

```

And this is the onActivityResult

```
    @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == IntentCode.INTENT_RESULT_CODE)
    messageString = data.getStringExtra(IntentCode.INTENT_MESSAGE_CODE);
    toDoList.add(messageString);
    theAdapter.notifyDataSetChanged();

```

Answer: 
It sounds like you may want something like the following.

```
arr = [section, :top, :course, :section_id, :text]
arr.reduce { |e,m| e && e.respond_to?(m) && e.public_send(m) } 

```

Because `reduce` has no argument the initial value of the *memo* `e` is `section`. If `e` becomes `nil` or `false` it will remain that value.
Whilst this is a bit outdated, the fact that `&.` won't work here when it is the most elegant perhaps gives rise for this being a useful feature

If you can raise it on GH with a sample page where this would be useful then we could look at getting it introduced

Luke