Usage examples with code snippets
This section provides basic examples to help you get started with writing Doglang programs.
Variable Assignment
Assign a value to a variable using the equals sign (=
):
Print Statement (bark
)
Use the bark
command to print values or messages:
Loop Statement (wagtail
)
The wagtail
keyword starts a loop which runs while the condition is true:
This loops from 0 to 4, printing each value.
Conditional Statement (sniff
)
Use sniff
to check conditions and optionally else
for alternate execution:
This prints "Even" if a
is even, otherwise prints "Odd".
Input Statement (fetch
)
Prompt the user for input using fetch
:
Running Doglang Code from Command Line
From File
Inline Code Execution
Explore these examples and start creating your own fun Doglang programs!