Cedric,
  Thanks very much. That works for the hello() function, but not exactly 
for the five() function. For instance, if I have

 function five()
return 5
end
five()

Then I get no output when calling from the Command Line, while I do in the 
REPL. In fact, in the REPL I get the output after include("five.jl") and 
then again when I call five(). That make sense to me. To get output at the 
Command Line I need to replace "five()" with "println(five())" or change 
the "return 5" statement to "return println(5)". Why is there the 
difference in behaviors? It's not a big deal, but it does seem like an 
inconsistency in how functions behave in the REPL and at the command line.

I seem to remember encountering a difference in behavior between the REPL 
and IJulia. Is there a document the lists the differences in Command Line, 
REPL, and IJulia environments.

Thanks,
Rich

On Monday, May 9, 2016 at 11:02:43 PM UTC-4, Cedric St-Jean wrote:
>
> hello.jl defines the hello() function, but you need to call it to get some 
> output. 
>

> function hello()
>        println("Hello World")
>  return
> end
>
> hello()
> hello()
>
> will print "Hello World" twice.
>
> On Monday, May 9, 2016 at 10:59:05 PM UTC-4, [email protected] wrote:
>>
>> Newbie question: Why don't I get any output from the following programs 
>> when I run them from the command line on my Macbook pro (OS 10.11.4) or two 
>> different versions of Linux. Everything works as expected when the programs 
>> are run in the REPL. 
>>
>> On the Mac I use the following in my PATH. 
>>
>> /Applications/Julia-0.4.5.app/Contents/Resources/julia/bin
>>
>> Command line: julia hello.jl
>> function hello()
>> println("Hello World")
>> return
>> end
>>
>> Command line: julia five.jl
>> function five()
>> return 5
>> end
>>
>> The scripts run fine with no apparent errors or warnings. They just don't 
>> produce any output. 
>>
>> Thanks,
>> Rich
>>
>

Reply via email to