lunduniversity / introprog

Teaching material for "Introduction to Programming using Scala" at Lund University, LTH. http://cs.lth.se/pgk/
141 stars 167 forks source link

Add exercise to train simplification of if-else-expressions #773

Open valterbergstrand opened 8 months ago

valterbergstrand commented 8 months ago

Title explains but an example would be something in the line of:

def isTrue(): Boolean = 
  if boolsktVärde == true then true
  else false

can be simplified to

def isTrue(): Boolean =
  boolsktVärde