Transform array

@AlanMatthews Would you please edit your prior posts,
and wrap your code in the forum markdown code delimiters, ie:

```ruby

code here

```

Those are backticks, the character that shares the key with the tilde (~) to the left of the 1 key. (You’ll likely need to re-indent the code as the forum has stripped out the leading whitespace.)


This is a Ruby Core interpreter issue. And assignment in any expression, is allowed under Ruby’s multi-paradigm philosophy. However, most coding style guides strongly discourage it, (or outlaw it for particular projects,) for the very reason that you found. It promotes errors that are hard to find.

So you’ll see the style guides say to make the assignment on the line preceding the conditional test (if, unless, while, until,) etc.

Saving one line of code is not worth it.


I meant why would you wish to create an identity transform
in the way you were attempting. (Ie, it doesn’t really work.)

I refer you to my post above, where I show that the API currently
has only one good way to create a new identity transform.
:arrow_right: Transform array - #4 by DanRathbun
And that the #identity? method is currently bugged.

Then I refer you to a post above, where Jim shows you that you can just use the global identity transform which is there for this very purpose. (It is a shared object so do not change it.)
:arrow_right: Transform array - #2 by jim_foltz