DEV Community

Discussion on: How do you feel about braces and semicolons?

Collapse
 
ben profile image
Ben Halpern • Edited

No braces and semicolons (I'm not actually sure anyone does this?)

Ruby has braces but are usually reserved for single-line declarations. This is the common block syntax.

@people.each do |person|
  person.say("hello")
end

if something
  do("something")
elsif something_else
  do("something else")
else
  do("nothing")
end

Ruby looks like Python but does not use significant whitespace. It's definitely an interesting case study for language syntax design.

Collapse
 
17cupsofcoffee profile image
Joe Clay

Ah, slightly confusing wording on my part - I meant 'no braces, yes semicolons' for that option :) Will rephrase that.

Either way, I really like Ruby's syntax! Lua has a similar thing going for it where it looks like a Python-ish language, but its grammar doesn't care about whitespace/line breaks.

Collapse
 
rhymes profile image
rhymes

I also have the feeling that using a delimiter might be easier for designing a new language, might be wrong though.

Definitely no semicolons :P