Code-quality rules an AI breaks: the correct forms
The complete source of forAI_quality_right.ek9, compiled by the EK9 compiler. Shown on forAI.html.
#!ek9 defines module site.forAI.quality defines function createConnection() -> host as String port as Integer dbName as String ssl as Boolean <- connected as Boolean: host? and port? and dbName? and ssl? lockAccount() Stdout().println("Account locked") findAll() as pure -> pattern as RegEx text as String <- found as List of String: text.split(pattern) checkIfEmpty() as pure -> container as List of String <- isEmpty as Boolean: container.empty() calculateTotal() as pure -> items as List of Float <- total as Float: 0.0 cat items > total welcome() -> name as String city as String <- greeting as String? message <- `Hello ${name}, welcome to ${city}` greeting: message connect() <- connected as Boolean? connection <- createConnection(host: "localhost", port: 5432, dbName: "mydb", ssl: true) connected: connection guardLogin() -> attempts as Integer maxAttempts <- 3 if attempts > maxAttempts lockAccount() search() -> pattern as RegEx text as String container as List of String <- summary as String? foundItems <- findAll(pattern, text) isEmpty <- checkIfEmpty(container) summary: `${foundItems} ${isEmpty}` addTax() -> items as List of Float price as Float tax as Float <- summary as String? total <- calculateTotal(items) combined <- price + tax summary: `${total} ${combined}`