// I want 'b' to equal 12
(
a = 7; // set 'a' to a value. BONUS! if someone notices I am using global vars (this will be a
// problem below (in problem 3)
b = a + 5;
)
// why doesn't this work?
(
var test;
test = 10;
("The value of test is: " ++ test).postln;
test = 20; // ADD SEMI-COLON
("The new value of test is: " ++ test).postln;
)
(
var a, product, mulAdd, result, b; // add 'b'
a = 15;
b = 3;
// THIRD or FOURTH b is using the global variable above. should be declared and given a value of 3
product = a * b;
"The result of the product is: ".post;
product.postln;
"It should equal 45... if it doesn't, what do you need to do? And why wasn't it in the first place?".postln;
mulAdd = {arg initVal, mulVal, addVal;
addVal + (initVal * mulVal); // THIRD or FOURTH - missing parens
};
// FIRST! - muladd needs to be mulAdd (case sensitive)
result = mulAdd.value(10, 10, 10);
"I want my result to equal 110... it equals: ".post;
result.postln; // SECOND! POSTLN spelled wrong
// below is a logic statement... we'll learn more about these later, but for now, you should know
// that the 'test' checks to see if result does NOT equal 110... if it doesn't, it posts a
// warning, telling you to fix your mulAdd function
(result != 110).if({
"Change the mulAdd function to give the correct result using parens!".warn;
});
)