Variable scope and order of parsing vs. operations: Assignment in an “if”
问题 My understanding is that the if statements at the end of the line are evaluated before the code at the front of the line: 'never shown' if (false) And assignment is possible in an if statement. 'shown' if (value = 'dave is king') value #=> "dave is king" And, when a variable that doesn't exist is assigned to, it is created. There is no need for it to exist beforehand. Is this true? If all these assumptions are true, why does this fail? error_array << error if (error = import_value(value)) #=>