In the first method you aren't doing an assignment, are sending the message = to the temp isValid, if you change the method to:
decimalFromBinary: aString
�������� | result isValid |
�������� isValid := self isValidBinary: aString.
�������� isValid
�������� ������ ifTrue: [ result := 0.
�������� ������ ������ aString reverse
�������� ������ ������ ������ withIndexDo:
�������� ������ ������ ������ ������ [ :digit :index | result := result + (digit
digitValue * (2 raisedTo: index - 1)) ].
�������� ������ ������ ^ result ]
�������� ������ ifFalse: [ ^ nil ]
it should work.
In the second one you're comparing characters with numbers, this will always return false because the number 0 is not the same as the character 0.
Use
isValidBinary: aString
�������� ^ aString allSatisfy: [ :c | c = $0 or: [ c = $1 ] ]
or something like
isValidBinary: aString
�������� ^ aString allSatisfy: [ :c | '01' includes: c ]