News for hackers. Stuff that matters.
Re:Neon Programming Language by braindongle on Thursday October 15, 2020 @06:17PM (#24794839)
If I'm teaching young'ns per se using a toy language, I'd reach for Scratch. It's history and Google's embrace of it seem like strong endorsements. Are there other good candidates in that space?

If I'm teaching an intro class using a general purpose language, it's Ruby or Python. My heart lies with Ruby, but having basic Python chops is such a bigger win downstream.

  for i in range(1, 101):
      if i % 15:
          print ('FizzBuzz')
      elif i % 3 == 0:
          print ('Fizz')
      elif i % 5 == 0:
          print ('Buzz')
      else:
          print (str(i))

  (1..100).each do |i|
    if i % 15 == 0
      puts 'FizzBuzz'
    elsif i % 3 == 0
      puts 'Fizz'
    elsif i % 5 == 0
      puts 'Buzz'
    else
      puts i
    end
  end
Re:Neon Programming Language by setpatchaddress on Thursday October 15, 2020 @06:34PM (#24795023)

  (1..100).each do |i|
   puts case
     when i % 15 == 0
       'FizzBuzz'
     when i % 3 == 0
       'Fizz'
     when i % 5 == 0
       'Buzz'
     else
       i
     end
   end
Re:Neon Programming Language by braindongle on Thursday October 15, 2020 @07:42PM (#24795709)
Yes, cleaner, and no switch in Python.
Re:Neon Programming Language by anitil on Thursday October 15, 2020 @09:06PM (#24796306)
(offtopic) You might be missing an '== 0' in the second line there? I've never done fizzbuzz so I honestly don't know, but the ruby version has it.
Re:Neon Programming Language by Semiapies on Friday October 16, 2020 @03:10AM (#24798355)
Zero and empty lists and dictionaries are treated as False in Python.