Issue #16020 has been reported by bogdanvlviv (Bogdan Denkovych).

----------------------------------------
Bug #16020: Forbid `if` `elsif` without a condition
https://bugs.ruby-lang.org/issues/16020

* Author: bogdanvlviv (Bogdan Denkovych)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
Hello.

I might have missed something, but examples like:
```ruby
if
  puts "!!!!1"
elsif
  puts "!!!!2"
elsif
  puts "!!!!3"
else
  puts "!!!!4"
end

# Output:
# !!!!1
# !!!!2
# !!!!3
# !!!!4
```

```ruby
if false
  puts "!!!!1"
elsif 1==2
  puts "!!!!2"
elsif
  puts "!!!!3"
else
  puts "!!!!4"
end

# Output:
# !!!!3
# !!!!4
```

are confusing. We probably should raise `SyntaxError` in the case when `if`/`elsif` is being used without any condition. What do you think about it?

Original source: https://twitter.com/bogdanvlviv/status/1154356514628493313



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>