LIVE Instructor-Led Courses
Dismiss
How to Get Started with M Language Training: A Beginner's Guide to Learning M

18 September 2023

How to Get Started with M Language Training: A Beginner's Guide to Learning M

M Language is a powerful low-code programming language used to build custom logic across the Microsoft Power Platform. With M Language training, you can rapidly develop apps, automate workflows, and integrate systems without needing to be an expert developer. This beginner's guide will teach you the basics of M Language and how to get started with hands-on training to be used as a support resource to JBI Trainings Power BI - Power Query & M

An Introduction to M Language

M Language is the coding language behind Microsoft Power Apps, Power Automate, and other components of the Microsoft Power Platform. It provides a simple yet robust way to add custom logic and build solutions.

Some key things to know about M Language:

  • Low-code approach: M minimizes the amount of hand-coding needed. It uses declarative techniques and built-in functions.
  • Versatile applications: Use M across the Power Platform - in Power Apps for app logic, Power Automate for workflow automation, Power BI for data transformations, and more.
  • Scalable and enterprise-ready: M Language solutions meet enterprise standards for governance, security, and performance.
  • Access to data and services: Connect natively to data sources like SharePoint, SQL, and hundreds of other apps and services.
  • Based on established languages: The syntax of M draws on languages like JavaScript, C#, and Excel formulas.

Learning M Language unlocks new possibilities for automating processes, building responsive apps, and getting more value from data. Even without an extensive coding background, you can quickly gain skills to enhance solutions on the Power Platform.

Benefits of M Language Training

Taking dedicated M Language training as a beginner has several advantages:

  • Structured learning: A course provides organized lessons on M Language fundamentals before diving into real-world applications.
  • Hands-on experience: Courses emphasize practical exercises with sample data and projects to cement your new skills.
  • Expert guidance: Instructors experienced in M can share best practices and problem-solving techniques.
  • Thorough understanding: Comprehensive training builds a solid M Language foundation for novice coders.
  • Prep for certification: Courses help prep for Microsoft's PL-200 exam to gain an M Language Developer Associate certification.
  • Application to the real-world: Apply M Language directly to automate and optimize business processes after training.
  • Community of peers: Connect with other beginners to discuss challenges and successes with M Language.

Dedicated training delivers structure, support, and practice opportunities beginners need to gain proficiency in M Language.

Pre-requisites for Learning M Language

While no prior coding experience is required to get started with M Language, having some background will help you get up to speed faster. Here are some recommended pre-requisites:

  • Basic Power Platform knowledge: Understand the core capabilities and components of Power Apps, Power Automate, Power BI, and the Dataverse.
  • Familiarity with data: Exposure to common data concepts like databases, tables, variables, arrays, and data types.
  • Logic fundamentals: Understanding of core programming basics like expressions, control flow, and functions.
  • Development environment skills: Experience with Visual Studio Code or another integrated development environment (IDE).
  • Admin access: Ability to install extensions and set up folders on your dev environment as needed.

Even if you are new to some of these areas, you can quickly gain the necessary knowledge by completing online courses and tutorials before embarking on dedicated M Language training.

Setting Up Your M Language Development Environment

Before writing your first line of M code, you need to setup an environment with the right tools. Here are the steps to get setup for M Language development:

Install Visual Studio Code

Visual Studio Code is a free, lightweight, open-source code editor with support for M Language.

  1. Go to https://code.visualstudio.com
  2. Download and install VS Code for your operating system.

Install the M Language Extension

This extension provides syntax highlighting, auto-completion, and other features for M Language files.

  1. Open VS Code.
  2. Click on the Extensions icon.
  3. Search for "Power Apps Tool" and install it.

Create Your First M Language Project

Now you need a project folder to store your M Language code files.

  1. In VS Code, click File > Open Folder and create a new empty folder.
  2. Right click on this folder and select "New File" to create a file like HelloWorld.m.
  3. Open HelloWorld.m and you're ready to start coding!

With these basic steps, your M Language coding environment is ready to go!

Learning M Language Programming Basics

Once your dev environment is setup, you can start learning the building blocks of the M Language:

Data Types

Like other languages, M has common data types including:

  • String: Text values like "Hello world"
  • Number: Numeric values like 5, 10.5
  • Boolean: Logical values like true and false
  • Table: Collection of data rows and columns

Variables

Variables store values in memory during execution. Declare them before use:


myNumber = 10
myText = "Hello" 

Expressions

Expressions combine variables, values, and operators to produce a result:


fullname = "Mary" & " " & "Johnson"

Operators

Operators allow you to perform actions on data:

  • Arithmetic like +, -, *, /
  • Comparison like >, <, =
  • Logical like &&, ||

Output

Use print to output values and text into the console:


print "Hello World"

These fundamentals power much of the code you will write in M Language.

Controlling Program Flow

Beyond the basics, M gives you control over the flow of your program logic using statements like:

If/Else Statements

Execute different code blocks based on conditionals:


if x > 10 then
    print "x is greater than 10" 
else
    print "x is less than or equal to 10"

For Loops

Repeat code on each item in a collection:

  
for i in [1, 2, 3] do
    print i

While Loops

Repeat code while a condition is true:


while x < 10 do 
    x = x + 1

Break

Stop execution and break out of the current loop.

Control flow statements allow you to build robust M Language solutions.

Working with Functions in M

Functions are reusable blocks of code that perform specific tasks:

Function Definition

Use the function keyword:


function addNumbers(x, y) {
  return x + y 
}

Function Calls

Pass parameters to execute the function:

  

sum = addNumbers(5, 10)

Functions help modularize your programs into logical components.

Handling Data with Tables

Tables store structured data in rows and columns. Use them to:

  • Store large datasets
  • Represent relationships between data
  • Filter, sort, and manipulate data

Common actions include:

  • Add rows with Table.AddRows()
  • Update rows with Table.Update()
  • Remove rows with Table.RemoveRows()
  • Read rows with Lookup() or Search()

Tables are a core concept for handling data in M Language.

Debugging M Language Code

Bugs happen - here are techniques to squash them in M Language:

Breakpoints

Pause execution at specific lines to inspect state.

Step Debugging

Step through code line-by-line to understand flow.

Inspection

Check variable values and object structures at runtime.

Logging

Use print to output checkpoints and diagnostics.

Robust debugging practices will accelerate your M Language development.

Interacting with Users

In apps, you need to capture user input and display outputs. Common techniques include:

User Input

Retrieve input from forms with functions like TextInput() or DropDown().

Output

Show user messages and visualizations with Notify() or graphing functions.

UI Creation

Build interfaces with controls like Button, Label, Gallery, and more.

Smooth user interactions will make your M Language programs intuitive and engaging.

Connecting to Data Sources

Access external data to power your M Language solutions:

  • Local Files: Read/write data to the local file system with CSV.Document().
  • Cloud Services: Connect to REST APIs, SharePoint, SQL, and hundreds of other data sources.
  • Import/Export: Move data in and out of Power Platform components like SharePoint lists.

Robust data connectivity unlocks the full potential of M Language.

Next Steps for Advancing Your M Language Skills

Once you grasp the fundamentals, here are some recommended next steps:

  • Practice with the M Language documentation and sample projects
  • Participate in the M Language community spaces to ask questions and share knowledge
  • Build out your portfolio by creating solutions for real business problems
  • Prepare for the PL-200 exam if you want to get certified as a Microsoft Power Apps + Dynamics 365 Developer Associate
  • Continue learning via in-person or online training programs and courses
  • Read advanced guides on architecture patterns, performance optimizations, and integration best practices

Dedicated practice and linking up with the broader community will help take your M Language skills to the next level.

Conclusion

This beginner's guide introduced the major building blocks of M Language - from development environment setup to programming fundamentals to techniques for real-world applications. With this foundation, you can start applying M Language to build responsive apps, workflow automation, AI-infused solutions, and more across the Power Platform. Learning M unlocks a simpler yet powerful approach to meet your organization's needs.

The key next step is practicing these concepts through hands-on M Language training. Guided courses with sample projects will accelerate your learning. Be patient, ask questions, and keep coding as you uncover the possibilities with M Language!

If you enjoyed this article you might like to look at the following resource guide How to Get Started with M Language and Power BI

Frequently Asked Questions

What are some beginner friendly M Language projects?

Some good starter projects include calculators, unit converters, simple games, polling/voting apps, expense trackers, and basic data entry forms. Start with the basics before moving to more advanced solutions.

Is M Language training required to use Power Platform features?

No, you can leverage Power Apps, Power Automate, Power BI and other components through their graphical "low-code" interfaces without needing to write M code. But learning M vastly expands what you can develop.

What other skills complement M Language proficiency?

Knowledge of JavaScript and C# can help you learn M faster. More broadly, skills in data, databases, APIs, Azure, Power Platform, and UX design will make you a well-rounded M Language developer.

Can I learn M Language on my own?

Yes, you can self-study M Language through Microsoft's documentation, community forums, and free online resources. However, instructor-led training provides structure and guidance that accelerates learning. But we would always recommend starting off with one of our courses at JBI Training 

 

About the author: Daniel West
Tech Blogger & Researcher for JBI Training

CONTACT
+44 (0)20 8446 7555

[email protected]

SHARE

 

Copyright © 2023 JBI Training. All Rights Reserved.
JB International Training Ltd  -  Company Registration Number: 08458005
Registered Address: Wohl Enterprise Hub, 2B Redbourne Avenue, London, N3 2BS

Privacy Policy | Terms & Conditions | Contact Us

POPULAR

Rust training course                                                                          React training course

Threat modelling training course   Python for data analysts training course

Power BI training course                                   Machine Learning training course

Spring Boot Microservices training course              Terraform training course

Kubernetes training course                                                            C++ training course

Power Automate training course                               Clean Code training course