diff --git a/xml/chapter3/section3/subsection4.xml b/xml/chapter3/section3/subsection4.xml
index 9d5ca6f62..311d55674 100755
--- a/xml/chapter3/section3/subsection4.xml
+++ b/xml/chapter3/section3/subsection4.xml
@@ -570,21 +570,6 @@ function logical_and(s1, s2) {
}
-
- logical_or
-
-function logical_or(s1, s2) {
- return s1 === 0 && s2 === 0
- ? 0
- : s1 === 0 || s1 === 1
- ? s2 === 0 || s2 === 1
- ? 1
- : error(s2, "invalid signal")
- : error(s1, "invalid signal");
-}
-
-
-
@@ -673,12 +658,32 @@ function and_gate(a1, a2, output) {
and_gate.
-
- or_gate
- get_signal
- after_delay
- logical_or
-
+
+
+
+ logical_or
+
+// contributed by GitHub user clean99
+
+function logical_or(s1, s2) {
+ return s1 === 0 && s2 === 0
+ ? 0
+ : s1 === 0 || s1 === 1
+ ? s2 === 0 || s2 === 1
+ ? 1
+ : error(s2, "invalid signal")
+ : error(s1, "invalid signal");
+}
+
+
+
+ or_gate
+ get_signal
+ after_delay
+ logical_or
+
+// contributed by GitHub user clean99
+
function or_gate(a1, a2, output) {
function or_action_function() {
const new_value = logical_or(get_signal(a1),
@@ -690,9 +695,9 @@ function or_gate(a1, a2, output) {
add_action(a2, or_action_function);
return "ok";
}
-
-
-
+
+
+