The code was a simple Hello World and a conditional variation so here is Julia code similar to the Python.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Conventionally | |
if var < 900 | |
println("Hello World") | |
end | |
# Short circuit evaluation | |
var < 900 && print("Hello World") | |
# And Combined with Ternary | |
print(isa(varA, String) ? "string involved" : | |
isa(varB, String) ? "string involved" : | |
varA == varB ? "equal" : | |
varA > varB ? "bigger" : | |
varA < varB && "smaller") | |
If you want a quick look at the language Learn Julia in Y Minutes is surprisingly good.
Your In[7] snippet uses "pass", which is a valid Python statement but is not defined in Julia. (It doesn't give an error here because it is in the branch of the conditional that isn't evaluated.) You could use "nothing" instead in Julia, which is the analogue of Python's "None".
ReplyDeleteThanks, I've amended the gist
Delete