; Use single line comments to clarify parts of code.Example:

; This program adds 1 and 2 and stores the result in x (define x (+ 1 2)); done

(string? "hi") ; Returns #t (True) indicating "hi" is a string (integer? 2) ; Returns #t (True) indicating 2 is an integer (boolean? #f) ; Returns #t (True) indicating #f is a boolean

; Make a variable to store text (define name "Zach") ; Create variables that are numbers (define num_one 3) ; num_one now have the value 3 (define num_two 4) ; num_two now has the value 4 (define sum (+ num_one num_2)) ; sum now has the value 7 (set! num_one 20) ; num_one now has the value 20

; For numbers use below (> x y) ; is x greater than y (>= x y) ; is x greater than or equal to y (< x y) ; is x less than y (<= x y) ; is x less than or equal to y (= x y) ; is x equal to y ; For strings use below (string>? x y) ; is x greater than y (string>=? x y) ; is x greater than or equal to y (string

## Logical Operators

## Use logical operators to check multiple conditions at once or one condition out of multiple.

; And Operator (and x y) ; Returns x and y ; Or Operator (or x y) ; Returns x or y ; Not operator (not x) ; Returns not x ; You can combine many booleans! (and x (or y z))

## Mathematical Operators

## Use mathematical operators to alter values.

+ Addition - Subtraction * Multiplication / Division remainder Remainder of division quotient Quotient of divisionExamples(+ a b) (* a b) ; Division (/ 5 2) ; Returns 5/2 (/ 5.0 2) ; Returns 2.5 (/ 6 2.0)) ; Returns 3. ; Quotient (quotient 13 5) ; Returns 2 ; Remainder (remainder 13 5) ; Returns 3 ; Absolute value (abs -2) ; Returns 2 ; Square root (sqrt 9) ; Returns 3 ; Raising to a power (expt x y) ; Returns x^y ; Rounding, rounds to even when the number is halfway between two integers (round 1.7) ; Returns 2 (round 3.1) ; Returns 3 (round 1.5) ; Returns 2 (round 2.5) ; Returns 2

## Random Numbers

; Random integer in [0, n) (random n); Returns random number in [0, 10) (random 10)

## Strings

## Strings are pieces of text. We can gain much information about strings and alter them in many ways using various methods.

; We can take a substring of a string. (substring string a b) ; returns the substring of string beginning at a and ending right before bExample(substring "example 1 3") ; returns ex

; This will print the numbers 1 to 10 each on it's own line (let loop ((i 1)) (if (= i 10) (begin (display i) (display "\n")) (begin (display i) (display "\n") (loop (+ i 1)))))

(if (BOOLEAN_EXPRESSION) (do something) )Example:

; x will only be doubled if x is positive (if (> x 0) (set! x (* x 2)))

(if (BOOLEAN_EXPRESSION) (do something) (do something else) ) ; if x is positive x is doubled, else x is set to 1 (if (> x 0) (set! x (* x 2)) (set! x 1))

; this will show equal (define x 7) (cond ((> x 7) 'greater) ((< x 7) 'less) ('equal))