Assignment operator in Go language

The := notation serves both as a declaration and as initialization. foo := “bar” is equivalent to var foo = “bar” Why not using only foo = “bar” like in any scripting language, you may ask ? Well, that’s to avoid typos. foo = “bar” fooo = “baz” + foo + “baz” // Oops, is … Read more

What does an underscore and interface name after keyword var mean?

It provides a static (compile time) check that boolType satisfies the ValueConverter interface. The _ used as a name of the variable tells the compiler to effectively discard the RHS value, but to type-check it and evaluate it if it has any side effects, but the anonymous variable per se doesn’t take any process space. … Read more

What are the precise rules for when you can omit parenthesis, dots, braces, = (functions), etc.?

You seem to have stumbled upon the answer. Anyway, I’ll try to make it clear. You can omit dot when using the prefix, infix and postfix notations — the so called operator notation. While using the operator notation, and only then, you can omit the parenthesis if there is less than two parameters passed to … Read more

text highlight in markdown

As the markdown documentation states, it is fine to use HTML if you need a feature that is not part of Markdown. HTML5 supports <mark>Marked text</mark> Else you can use span as suggested by Rad Lexus <span style=”background-color: #FFFF00″>Marked text</span>

Kotlin secondary constructor

Update: Since M11 (0.11.*) Kotlin supports secondary constructors. For now Kotlin supports only primary constructors (secondary constructors may be supported later). Most use cases for secondary constructors are solved by one of the techniques below: Technique 1. (solves your case) Define a factory method next to your class fun C(s: String) = C(s.length) class C(a: … Read more

What is the difference between syntax and semantics in programming languages?

TL; DR In summary, syntax is the concept that concerns itself only whether or not the sentence is valid for the grammar of the language. Semantics is about whether or not the sentence has a valid meaning. Long answer: Syntax is about the structure or the grammar of the language. It answers the question: how … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)