chore: beautful lines

This commit is contained in:
2025-04-19 20:02:42 +02:00
parent 0346b79dd2
commit 4a86a2076b

View File

@@ -499,6 +499,7 @@ local function divideANumberByAnOther(a, b)
return a / b -- it would be better to validate parameters, but this is for example purposes return a / b -- it would be better to validate parameters, but this is for example purposes
end end
------------------------------- -------------------------------
-- First scenario: error case -- First scenario: error case
------------------------------- -------------------------------
@@ -511,8 +512,6 @@ end
-- Output: An error has occured : -- Output: An error has occured :
------------------------------- -------------------------------
-- Second scenario: valid case -- Second scenario: valid case
------------------------------- -------------------------------
@@ -527,10 +526,9 @@ end
---------------------------------------------------------------------
----------------------------------
-- Third scenario: combine pcall with assert for critical operations -- Third scenario: combine pcall with assert for critical operations
---------------------------------- ---------------------------------------------------------------------
local function readFile(fileName) local function readFile(fileName)
local fileToRead = assert(io.open(fileName, "r"), "Impossible to read the file") local fileToRead = assert(io.open(fileName, "r"), "Impossible to read the file")
@@ -551,10 +549,9 @@ end
-----------------------------------------------------------------------
--------------------------------
-- Fourth scenario: pcall with a function that returns multiple values -- Fourth scenario: pcall with a function that returns multiple values
-------------------------------------- -----------------------------------------------------------------------
local function sumAndProduct(a, b) local function sumAndProduct(a, b)
return a + b, a * b return a + b, a * b
end end