{"id":25976049,"url":"https://github.com/cewitte/learn-mojo","last_synced_at":"2025-07-01T02:39:35.698Z","repository":{"id":224427617,"uuid":"760703898","full_name":"cewitte/learn-mojo","owner":"cewitte","description":"Code for freeCodeCamp's YouTube video \"Mojo Programming Language – Full Course for Beginners\".","archived":false,"fork":false,"pushed_at":"2024-02-25T22:15:31.000Z","size":298,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-05T03:34:17.161Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cewitte.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-02-20T19:29:34.000Z","updated_at":"2024-02-25T21:05:39.000Z","dependencies_parsed_at":"2024-02-25T22:48:39.830Z","dependency_job_id":null,"html_url":"https://github.com/cewitte/learn-mojo","commit_stats":null,"previous_names":["cewitte/learn-mojo"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cewitte/learn-mojo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cewitte%2Flearn-mojo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cewitte%2Flearn-mojo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cewitte%2Flearn-mojo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cewitte%2Flearn-mojo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cewitte","download_url":"https://codeload.github.com/cewitte/learn-mojo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cewitte%2Flearn-mojo/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262885532,"owners_count":23379623,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-05T03:34:04.800Z","updated_at":"2025-07-01T02:39:35.650Z","avatar_url":"https://github.com/cewitte.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# learn-mojo\n\n![Austin Powers' Mojo](https://cdn.quotesgram.com/img/25/85/1657983419-Austin-Powers-Mojo.jpg)\n\nThis GitHub repository contains the example code presented along freeCodeCamp's YouTube video [Mojo Programming Language – Full Course for Beginners](https://youtu.be/5Sm9IVMet9c?si=IVlbAj6FuW5Ffavx). This introductory Mojo course was recorded by [@elliotarlege](https://www.youtube.com/channel/UCjlt_l6MIdxi4KoxuMjhYxg).\n\nAlthough there is an official [GitHub repository](https://github.com/Infatoshi/intro-to-mojo) linked in the YouTube video's description, as of this writing it does not contain all the code presented by Elliot. This was my motivation to create this repository and make it public.\n\n# Repository contents\n\nElliot sectioned his video into topics for which he presented live code examples. I've done my best to replicate Elliot's examples in each of the folders listed below, although you can expect some changes because Eliot makes changes quite frequently throughout the video, sometimes based on previous examples.\n\nBelow you will find the topics covered by Elliot in the order they were presented and a brief explanation of the topic or code contained in it:\n\u003cbr/\u003e\u003cbr/\u003e\n\n## :file_folder: hello-world\nContains a hello world that includes importing Python libraries and reading from user input on the terminal.\n\u003cbr/\u003e\u003cbr/\u003e\n\n## :file_folder: if-else-statements\nExactly as it says: a simple `if` with `else` and `elif` usage. \n\u003cbr/\u003e\u003cbr/\u003e\n\n## :file_folder: loops\nUsage of `for` and `while` loops.\n\u003cbr/\u003e\u003cbr/\u003e\n\n## :file_folder: simulating-arrays\nAs of now, Mojo does not support arrays yet. This code shows how to import and use `PythonObject` to simulate an array through an object.\n\u003cbr/\u003e\u003cbr/\u003e\n\n## :file_folder: functions\nThe same function in Python and Mojo syntax, with some minor differences like, in Mojo, you should be explicit (i.e. Int8) whenever possible.\n\u003cbr/\u003e\u003cbr/\u003e\n\n## :file_folder: objects\nHow to create classes, comparing Python and Mojo. Take a look at `main.py` and `main.mojo`.\n\u003cbr/\u003e\u003cbr/\u003e\n\n## :file_folder: libraries\nCode shows how to import Python libraries, using `numpy` as an example.\n\u003cbr/\u003e\u003cbr/\u003e\n\n## :file_folder: raises\nExemplifying exceptions and errors with `raises`, `try`, `except` and `finally` while simulating the opening of a file.\n\u003cbr/\u003e\u003cbr/\u003e\n\n## :file_folder: function-arguments\nUsage of `inout` (mutable), `borrowed` (immutable) and `owned` (transfer ownership) for variables. This has more comments because these concepts may be kinda hard to grasp.\n\u003cbr/\u003e\u003cbr/\u003e\n\n## :file_folder: with\nOnly Python code. Usage of `with` in Mojo has not been covered in the video tutorial. \n\u003cbr/\u003e\u003cbr/\u003e\n\n## :file_folder: mojo-packages\nAn example showing how to create mojo packages to be used elsewhere. Plese refer to `package-command.md` for instructions on how to use the `mojo package \u003cPACKAGE SOURCE FOLDER\u003e -o \u003cPACKAGE NAME\u003e.mojopkg`.\n\u003cbr/\u003e\u003cbr/\u003e\n\n## :file_folder: SIMD\n`SIMD`: Single Instruction Multiple Data, the coolest type ever: it's essentially a CPU instruction, for instance, if you have an array, you perform an operation through all of that array through SIMD. \n\nIn Python, you would have something like...\n\n```arr = [2, 4, 6, 8]```\n\n... and if you wanted to multiply all of its elements, you would have to loop trough it. With `SIMD` you do everything in one operation.\n\u003cbr/\u003e\u003cbr/\u003e\n\n## :file_folder: decorators\nMetaprogramming using decorators like `@unroll`, but covered very superficially.\n\u003cbr/\u003e\u003cbr/\u003e\n\n# How to run the examples\nAssuming you have Mojo installed, go to each folder and run from the terminal:\n\n```mojo main.mojo```\n\nYou can also `mojo build [options] \u003cpath\u003e` to create [executable files](https://docs.modular.com/mojo/cli/build.html#synopsis) if you really want to.\n\nFor the few Python files, it should be like `python3 main.py` or `python main.py` for earlier versions of Python.\n\u003cbr/\u003e\u003cbr/\u003e\n\n# Thank you notes\n\nThank you [Elliot Arledge](https://github.com/Infatoshi) and [freeCodeCamp](https://www.freecodecamp.org) for the great Mojo video introduction.\n\n---\nMade with :heart: by Carlos Eduardo Witte.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcewitte%2Flearn-mojo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcewitte%2Flearn-mojo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcewitte%2Flearn-mojo/lists"}