The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
notebook code error
01-02-2023, 07:10 AM
Post: #1
notebook code error
Hi, I'm trying to make a notebook-style application, but it gives me a syntax error and I can't find the solution.
Code:
EXPORT Notebook()

BEGIN
  // Define variables for notebook and notes
  LOCAL notebook, notes;
  notebook := {};
  notes := {};

  // Define main menu options
  LOCAL mainMenuOptions;
  mainMenuOptions := ["New note", "View notes", "Delete note"];

  // Main menu loop
  WHILE TRUE DO
    // Display main menu
    mainMenuOption := Menu("Notebook", mainMenuOptions);

    // Handle main menu option selection
    CASE mainMenuOption OF
      1:
        // Create new note
        noteTitle := Input("Enter note title: ");
        noteText := Input("Enter note text: ");
        note := {noteTitle, noteText};
        notes := {note, notes...};
        Disp("Note created successfully.");
      2:
        // View notes
        IF notes = {} THEN
          Disp("No notes to display.");
        ELSE
          noteTitles := {};
          FOR i TO LENGTH(notes) DO
            noteTitles := {noteTitles, notes[i][1]};
          END;
          noteIndex := Menu("Notes", noteTitles);
          Disp("Title: " + notes[noteIndex][1]);
          Disp("Text: " + notes[noteIndex][2]);
        END;
      3:
        // Delete note
        IF notes = {} THEN
          Disp("No notes to delete.");
        ELSE
          noteTitles := {};
          FOR i TO LENGTH(notes) DO
            noteTitles := {noteTitles, notes[i][1]};
          END;
          noteIndex := Menu("Notes", noteTitles);
          notes := {notes[1...noteIndex-1], notes[noteIndex+1...]};
          Disp("Note deleted successfully.");
        END;
    END;
  END;
END;
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
notebook code error - DrEureka - 01-02-2023 07:10 AM
RE: notebook code error - Didier Lachieze - 01-02-2023, 08:34 AM
RE: notebook code error - DrEureka - 01-04-2023, 04:18 AM
RE: notebook code error - Dougggg - 01-03-2023, 01:06 AM
RE: notebook code error - DrEureka - 01-04-2023, 04:22 AM
RE: notebook code error - DrEureka - 01-04-2023, 04:39 AM
RE: notebook code error - roadrunner - 01-04-2023, 01:47 PM



User(s) browsing this thread: 2 Guest(s)