I am currently studying D and taking baby steps, so please bear with me.
I am reading a book simply called "Programming Language D". I am using D-IDE for my code. I am currently writing a program that should add words to a dictionary (dictionary) if the book does not already have a word.
The problem is that the code provided by the book is invalid, and instead of just moving on and reading what the results should be, etc., I wanted to try and solve it. Of course, the problem is that I'm so new to D.
The code is as follows:
import std.stdio, std.string; void main() { uint[string] dictionary; foreach(line; stdin.byLine()) {
The IDE says Error: undefined identifier splitter , and since I am pretty good at Java, I think the error means that the method does not exist and that it tried to treat it as a variable, but that also does not exist. So I tried changing it to "split". This leads to another error in the dictionary phrase: Error: associative arrays can only be assigned values with immutable keys, not char[]
Therefore, I do not know what to do to solve this problem and make it work. So it’s frustrating when the code from the books that should teach you does not work. I am using dmd2.
source share