First steps · 3 / 69
Keep state local
YOUR TASK
Make this happen
A local variable belongs to its lexical scope. Update a local accumulator before exporting its value. This prevents accidental global names and makes the calculation easy to follow.
Read the cases in
lesson.test.lua, then choose Check solution to see what needs to change.Update
subject.luauntil every test passes. Keep the supplied tests unchanged.
Read the starter and tests
subject.lua
local count = 2 exports.count = count
lesson.test.lua
local t = require("test")
local subject = require("cococo.subject")
t.it("adds three", function()
local s = subject.load()
t.expect(s.count):eq(5)
end)