Skip to content

PierrickBlons/LiftUpConditional

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Demo code for Lift-Up Conditional Introduction learning hour

Those code examples in different language are companion code for the Lift-Up Conditional introduction learning hour.

How to use this example

During the concept part 2, you can use this code to demonstrate the Lift-Up conditional technique to move the if(b) condition at the beginning of the function.

Example in OCaml

Initial code

let liftUpConditional a b =
  if a then 
    if b then 
        "ATrueBTrue"
    else
        "ATrueBFalse"
  else
    if b then 
        "AFalseBTrue"
    else
        "AFalseBFalse"

should be safely transformed like this with the Lift-Up conditional technique.

let liftUpConditional a b =
  if b then 
    if a then 
        "ATrueBTrue"
    else
        "AFalseBTrue"
  else
    if a then 
        "ATrueBFalse"
    else
        "AFalseBFalse"

About

Lift Up Conditional kata

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published