Basic Syntax:Functions are declared using the fn keyword, followed by parenthesis and then brackets which define the logic of the function. For example, my two functions in the program to the left are main() and binary_search(). In Rust, functions are declared using the camel_case convention(like python). Parameters' types in rust must be explicity declared using the : keyword. The return value of a function is specified by using the -> followed by the return type.
For example, in my binary_search function, it takes a reference to an array (&[i32]), followed by an integer that it is looking for(i32), and returns a bool(->bool).
Control Flow: Rust enables the use of if, else, and else if statements. Unlike other langauges, the condition of theese statements does not need to be included in paraenthesis, which is showcased to the left. Similar to C or Java, the logic to be executed if the condition is true is enclosed by brackets({}).
Synatx:Similar to C, a reference to an object can be constructued by using the & keyword. Additonally, in arrays or vectors, the (..), can be used to specifiy until the end of the array or vector, which is showcased in my binary_search recursive calls.
Additonally, except for values you wish to return from a function, every logic line must have a ; at the end of the line. For example, the two binary_search recursive calls do not have a ; at the end, while the return true line does.