From b9033614305e2b3a743ab405fcf6063fa8bd2e73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phaneDucasse?= Date: Wed, 11 Sep 2024 16:50:09 +0200 Subject: [PATCH] adding an example of sync --- Chapters/Chapter2/chapter2.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Chapters/Chapter2/chapter2.md b/Chapters/Chapter2/chapter2.md index 59ba6e4..115e009 100644 --- a/Chapters/Chapter2/chapter2.md +++ b/Chapters/Chapter2/chapter2.md @@ -13,4 +13,15 @@ Output directory's default name is ''book-result'' but you can change it in the ![blue](figures/pharo.png width=30) -![jlklkjlk](figures/rmod.png width=30) \ No newline at end of file +![jlklkjlk](figures/rmod.png width=30) + + +### Example of Sync + +Now we can make sure that when we copy some code the checker will report to us if the code changed from the book. + +```sync=true&origin=Point >> #degrees +degrees "Answer the angle the receiver makes with origin in degrees. right is 0; down is 90." | tan theta | + "I changed this method my friend so you should report it" ^ x = 0 ifTrue: [ y >= 0 ifTrue: [ 90.0 ] ifFalse: [ 270.0 ] ] ifFalse: [ tan := y asFloat / x asFloat. theta := tan arcTan. x >= 0 ifTrue: [ y >= 0 ifTrue: [ theta radiansToDegrees ] ifFalse: [ 360.0 + theta radiansToDegrees ] ] ifFalse: [ 180.0 + theta radiansToDegrees ] ] +``` +