Skip to content

Instantly share code, notes, and snippets.

@pfitzseb
Created October 13, 2014 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pfitzseb/b7843733dbac9d085b2b to your computer and use it in GitHub Desktop.
Save pfitzseb/b7843733dbac9d085b2b to your computer and use it in GitHub Desktop.
Juno tutorial
# Welcome to Juno!
# If you're new to Julia, you can find a tutorial here:
# http://link to a nice tutorial.com
# Generally, if there's something you'd like to do but don't know how, try
# searching in the command bar (Ctrl + Space) - almost all possible commands
# can be found there.
# To evaluate a line of code, press C + Enter¹. The result will be displayed
# inline, while using e.g. print will display the output in the console
# (View -> Console).
1 + 1
println("Hello World!")
# If the cursor is inside a block of code, pressing C + Enter will evaluate
# the entire block and display the last result inline.
begin
println(cos(π))
t = cos(π)
end
for i = 1:10
i^2
end
function square(x)
return x*x
end
# You can have a look at the variables and functions defined in the
# current file by opening the object browser (View -> Object browser).
# The documentation for functions is available via Ctrl + D and all methods
# of a function will be listed with Ctrl + M.
sin(4)
# Note, however, that all methods will be displayed, not the curently used
# one (this is because of Julia's dynamic nature: Juno can't generally
# determine the type of the input arguments).
# If errors are encountered during the evaluation of some Julia code,
# Juno will display the backtrace and provide a link to the faulty
# line of code.
function iError(x)
[x x]*[x x]
end
iError(1)
# This error message can be removed by either fixing the problem and
# re-evaluating, double-clicking it or right clicking and selecting
# 'Remove result'.
# ¹ C = Cmd on Mac
# = Ctrl on Linux and Windows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment